开发者

query for selecting top 5 salaries from table [duplicate]

开发者 https://www.devze.com 2023-02-16 13:48 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to select top N from a table
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

精彩评论

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