id type1 22 13 14 15 16 17 28 29 2select id from table where type=1 order by id desc limit 2,3查詢(xún)到的是id 4,3,2 。 即滿(mǎn)足type=1的數(shù)據(jù)里面偏移2位的前3條數(shù)據(jù)。如何能查詢(xún)到整個(gè)表偏移2位后,滿(mǎn)足type=1的id?即從id=7 開(kāi)始往上滿(mǎn)足type=1的前3條數(shù)據(jù),查詢(xún)到應(yīng)該是id 6,5,4。 應(yīng)該如何做到?
1 回答

largeQ
TA貢獻(xiàn)2039條經(jīng)驗(yàn) 獲得超8個(gè)贊
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
添加回答
舉報(bào)
0/150
提交
取消