[英]select next row in mysql database using PHP
我正在運行選擇SQL查詢:
select * from table where sequence = '6'
我希望能夠獲得下一行,但是它可能不是序列7,因為它可能不存在。
如果下一行是序列9,我將如何選擇它?
按sequence
並使用limit
定義偏移量1
select * from your_table
where sequence >= 6
order by sequence
limit 1, 1
我不知道這是否有幫助...
select * from table where sequence > '6' order by sequence ASC limit 0,1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.