不知有没有办法完成:
SELECT * FROM table
通过使用 LIMIT
和 OFFSET
像这样:
SELECT * FROM table LIMIT all OFFSET 0
我可以编写 SQL 语句 使用 LIMIT 和 OFFSET 但仍然得到 ALL 结果吗?
* 当然我可以使用 IF
语句,但如果可能的话我宁愿避免使用它
最佳答案
来自 MySQL 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;
所以获取所有行可能如下所示:
SELECT * FROM tbl LIMIT 0,18446744073709551615;
关于mysql - 使用 SQL LIMIT 和 OFFSET 查询选择所有记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15950871/