Choose from the nth record, etc. In MySQL

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

Ok i have a sql query like this

SELECT * FROM `profile_registry` LIMIT 3, 100 

Now I want to get data here, starting from the third row, etc.

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

the condition of only one parameter is that it controls the number of rows returned.

the condition of two parameters is the first parameter that defines the starting point, and the second parameter determines the number of records returned.

Now my problem here is that I cannot set the second parameter, as if there are only 100 of it, since we do not know how many records will be in the future. Which one I want to return all records, starting from a specific row, without setting a limit on the number of rows to return .

+4
source share
1 answer

From the documentation :

To get all the lines from a specific offset to the end of the set result, you can use some large amount for the second parameter. This statement retrieves all rows from the 96th row to the last:

 SELECT * FROM tbl LIMIT 95,18446744073709551615; 
+7
source

Source: https://habr.com/ru/post/1437940/


All Articles