开发者

query for selecting top 5 salaries from table [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to select top N from a table

How can a write a query for selecting the top 5 salaries from table开发者_JS百科 ?


SELECT TOP 5 Salary
   FROM SalariesTable
   ORDER BY Salary DESC


SELECT TOP 5 Salary
FROM Salaries
ORDER BY Salary DESC


To get the TOP 5 highest Salaries:

SELECT DISTINCT TOP 5 MAX(Salary)
  FROM Salaries
 GROUP
    BY Salary
 ORDER 
    BY Salary DESC;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜