从MySQL查询返回第n条记录 [英] Return the nth record from MySQL query
本文介绍了从MySQL查询返回第n条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要从MySQL查询返回第二条,第三条或第四条记录(基于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.
这篇关于从MySQL查询返回第n条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文