日期:2014-05-16  浏览次数:20857 次

oracle 用rownum作分页查询时 提示缺失右括号??
SELECT * FROM s.employees WHERE employeeid IN(SELECT employeeid FROM s.tax WHERE ROWNUM<=6 ORDER BY tax DESC) 
不知道错在哪了?

------解决方案--------------------
SQL code

--试下这个,这种写法不好,可用exists代替的,还有rownum是先生成,后排序,因此你排序后选rownum<=6
--和没排选一样的,没有任何作用
select * from s.employees where employeeid in
(select employeeid from (select employeeid from s.tax order by tax desc)
where rownum<=6);