id type1 22 13 14 15 16 17 28 29 2select id from table where type=1 order by id desc limit 2,3查詢到的是id 4,3,2 。 即滿足type=1的數據里面偏移2位的前3條數據。如何能查詢到整個表偏移2位后,滿足type=1的id?即從id=7 開始往上滿足type=1的前3條數據,查詢到應該是id 6,5,4。 應該如何做到?
1 回答

largeQ
TA貢獻2039條經驗 獲得超8個贊
select * from a where id not in(
select t.id from(
select id from a order by id desc limit 0,2
) t
) and type=1 limit 2,3
添加回答
舉報
0/150
提交
取消