Thursday, February 10, 2011

GET THE MAX ( WITH THE HELP OF RANKS) -- Dense_Rank

SELECT ename, sal, DENSE_RANK () OVER (ORDER BY sal DESC) ranks
  FROM emp





SELECT *
  FROM (SELECT ename, sal, DENSE_RANK () OVER (ORDER BY sal DESC) ranks
          FROM emp) emplrank
 WHERE ranks = 3









No comments:

Post a Comment