Protected by Copyscape Web Copyright Protection Software

Search This Blog

Thursday, September 13, 2012

Query for display the first two highest salaries in dept wise

select  deptno,sal,ename from emp e
where 2>(select count(d.sal) from emp d where e.deptno=d.deptno and e.sal<d.sal) order by 1,3 desc

No comments:

Post a Comment