[SQL] SELECT R.* FROM ( SELECT (ROW_NUMBER () OVER (ORDER BY a.id3 ASC)) AS rownum, id,id2,id3

2025-04-26 23:20:56
推荐回答(2个)
回答1:

select r.*
from
(SELECT (ROW_NUMBER () OVER (ORDER BY a.id3 ASC) as rn,id,id2,id3 from xxx a where a.id2 = 'xxxxxxx') r
WHERE R.rnBETWEEN 1 AND 15

 你别起别名叫rownum,这是oracle关键字 ,另外你子查询写法不对

回答2:

这个SQL没问题,你sql没贴全吧