--查找出部门10和部门20中,工资最高第3名到第5名的员工的员工名字,部门名字,部门位置
select * from
(select ename,sal,dept.* from emp
join dept on dept.deptno=emp.deptno
where emp.deptno != 30 order by sal desc )
where rownum between 3 and 5;
本来应该是有的,结果显示未选定行
--查找出部门10和部门20中,工资最高第3名到第5名的员工的员工名字,部门名字,部门位置
select * from
(select ename,sal,dept.* from emp
join dept on dept.deptno=emp.deptno
where emp.deptno != 30 order by sal desc )
where rownum between 3 and 5;
本来应该是有的,结果显示未选定行
select * from (
select mysal.*, rownum rn from (
select e.ename, e.sal, e.deptno from emp e join dept d on e.deptno=d.deptno
where e.deptno != 30 order by sal desc) mysal
where rownum <= 5)
where rn >= 3;
另外不用在这里不用left也是可以的= =~