Get the top 5th salary of all employees

SELECT SALARY FROM


(SELECT VAL1, RANK() OVER (ORDER BY VAL1 DESC) R from TEMPX)


WHERE R=5;


OR


SELECT DISTINCT (a.sal) FROM EMP A WHERE 5= (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);


Comments

Popular posts from this blog

Andriod App that uses Google App Engine as Backend

FETCH DISTICT ROWS USING HIBERNATE

Logging the right way