从 MySQL 查询返回第 n 条记录
2021-11-20 00:00:00
mysql
我希望从 MySQL 查询中返回第 2、3 或 4 条记录(基于按 ID 升序的查询)
I am looking to return the 2nd, or 3rd, or 4th record from a MySQL query (based on a query by ID ascending)
问题是,我不知道 ID,只知道它是查询中的第三行.
The problem being, I won't know the ID, only that it is the 3rd row in the query.
推荐答案
SELECT * FROM table ORDER BY ID LIMIT n-1,1
它说返回一个从记录 n 开始的记录.
It says return one record starting at record n.
相关文章