select e1.* from (select * from emp order by hiredate) e1 where rownum <=10可以出結果;select e1.* from (select * from emp order by hiredate) e1 where rownum >=3;除了1以外,都顯示未選定行為什么???
2 回答

阿晨1998
TA貢獻2037條經驗 獲得超6個贊
試試這樣
select e1.*,case when rownum>=3 then '未選定' else '選定' end sel
from (select * from emp order by hiredate) e1 where rownum <=10

白衣染霜花
TA貢獻1796條經驗 獲得超10個贊
因為rownum是查詢出來數據后進行的排序,所以用>=n的時候不行,可以這樣理解,你要給依次到來的10個小朋友編號1-10,所以,你肯定不能從3開始編到10(這里類似于>=3),但是你卻可以給只到來的前3個小朋友編號為1-3(這里類似于<=3)
添加回答
舉報
0/150
提交
取消