查询从表中选择前5名工资

时间:2011-03-14 14:27:25

标签: sql

  

可能重复:
  How to select top N from a table

如何编写查询以从表中选择前5名工资?

3 个答案:

答案 0 :(得分:3)

SELECT TOP 5 Salary
   FROM SalariesTable
   ORDER BY Salary DESC

答案 1 :(得分:2)

SELECT TOP 5 Salary
FROM Salaries
ORDER BY Salary DESC

答案 2 :(得分:2)

获得TOP 5最高工资:

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