ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Subject:   how do we find nth highest in SQL
Date:   2009-10-13 11:57:45
From:   Sandip D
Response to: how do we find nth highest in SQL

SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
Enter value for n: 2
SAL
---------
3700

1 to 1 of 1
1 to 1 of 1