How can select last 7 max salaries from this table? [closed]
NAME AGE DEPTNO SALARY
-------------------- ---------- ---------- ----------
shasank 25 11 2025
raju 27 12 2027
bali 31 10 2031
rambo 开发者_StackOverflow 32 11 2121
chir 34 10 2123
son 33 12 2131
don 33 11 2132
ram 28 13 2141
nag 35 10 2213
dimpu 33 12 2314
SELECT * FROM yourTable ORDER BY SALARY DESC LIMIT 7
select top(7) *
from table
order by salary desc
MS SQL:
SELECT TOP 7 salary FROM table1 GROUP BY salary
MySQL:
SELECT salary FROM table1 GROUP BY salary LIMIT 0,7
精彩评论