Header Ads

ad

How to get 2nd | 3rd | nth highest value in Oracle | MySql

How to get 2nd | 3rd | nth highest value in Oracle | MySql


SELECT ID FROM player e1 WHERE N-1 = (SELECT COUNT(DISTINCT ID) FROM player e2 WHERE e2.ID > e1.ID)

N=> nth highest element of a column like 
For second highest 2-1
For third highest  3-1

No comments