开发者

how can i limit the selection in MySQL?

I am confuse on how to limit selection in MySQL (e.g SELECT * FROM tblProduction LIMIT 1,N;) where N is unknown.. Can anyone help me on how can I limit the selection in MySQL? I want to show the records starting from row 2 (two) up to the end of the records. Thanks开发者_运维知识库!


This is from the LIMIT 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;

EDIT: So in your case you would just change 95 to 2. Then you would get all rows starting from the 2 result.


Hi you can either pass the N value by Query string or some cookie.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜