4

Possible Duplicate:
MySQL LIMIT/OFFSET: get all records except the first X

Ok I do have a sql query like this

SELECT * FROM `profile_registry` LIMIT 3, 100

now what i want here is to get data starting from the 3rd row and so on.

The code above works but the problem is the LIMIT can be used by using one or two parameters.

the condition of the only one parameter is it only controls how many rows to return.

the condition of the two parameters is the first parameter defines the starting point and the second parameter defines how many records to return.

Now my problem here is I can't set the second parameter as if its only 100 as we don't know how many records will be in the future. What I want is to return all the records starting on a certain row without setting a limit on how many rows to return.

Community
  • 1
  • 1
Netorica
  • 18,523
  • 17
  • 73
  • 108
  • @aleroot sorry I was trying to look for any existing answer in SO but existing question's title is quite obscure for mysql newbies.. I know this would help for the newbies in the future, pleae don't close it – Netorica Oct 05 '12 at 06:35

1 Answers1

7

From the documentation:

To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:

SELECT * FROM tbl LIMIT 95,18446744073709551615;
lc.
  • 113,939
  • 20
  • 158
  • 187