How can I limit the choice in MySQL?

I am confused how to limit the choice in MySQL (e.g. SELECT * FROM tblProduction LIMIT 1, N;), where N is unknown. Can someone help me on how to limit the choices in MySQL? I want to show records from line 2 (two) to the end of the records. Thank!

+3
source share
2 answers

This is from the LIMIT documentation:

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

SELECT * FROM tbl LIMIT 95,18446744073709551615;

EDIT: So, in your case, you just change the value of 95 to 2. Then you get all the lines starting from result 2.

+6

, N , cookie.

"SELECT * FROM tblProduction LIMIT 1,".$_GET[Limit];
-2

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


All Articles