469,090 Members | 1,217 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,090 developers. It's quick & easy.

Mysql - Uses of Offset ?

147 100+
What is the purpose of OFFSET in mysql ?

Expand|Select|Wrap|Line Numbers
  1.    mysql>select * from info oFFSET 3 ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3' at line 1
Apr 5 '10 #1
3 8112
5,058 Expert 4TB

Also see the part about LIMIT in the Manual (12.2.8. SELECT Syntax)

Basically, the MySQL syntax to LIMIT the rows a result set will return goes:
Expand|Select|Wrap|Line Numbers
  1. SELECT ... LIMIT x, y
Where "x" is the number of rows you want returned and "y" is the offset. (Offset meaning; the number of rows to remove from the top of the list.)
For example, if you have a 100 rows in the original result set a "LIMIT 10, 20" would return rows #21 through #30. That is; 10 rows starting after #20.

For compatibility with PostgreSQL, you can optionally replace the comma in the LIMIT syntax with the OFFSET keyword.
Expand|Select|Wrap|Line Numbers
However, this is optional. You don't need to do this unless you plan on building PostgreSQL compatible queries.
Apr 6 '10 #3
147 100+
I got it....thanks for your response
Apr 6 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by jimmy | last post: by
2 posts views Thread by info | last post: by
30 posts views Thread by Einstein30000 | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.