Query to find second and third highest value

By Amol Jadhav

Query to find second and third highest value
SQL query to find second and third highest value in empid column
Replace empid column name with salary to apply the logic on salary column

SQL Querysql
1SELECT *
2  FROM (SELECT ROWNUM row_num, b.*
3          FROM (  SELECT e.*
4                    FROM emp e
5                ORDER BY empid DESC) b)
6 WHERE row_num IN (2, 3)

Related posts: