Wednesday, 15 May 2013

Sql Query For Nth Salary


 Find out nth highest salary from emp table

SELECT DISTINCT (a.sal) FROM test A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM test B WHERE a.sal<=b.sal);

No comments:

Post a Comment