如何找到重复的工资

时间:2011-04-25 08:52:00

标签: sql

我这样做:

SELECT salary COUNT(salary ) AS NumberOfTimes
FROM person
GROUP BY salary   
HAVING (COUNT(salary) > 1) 

2 个答案:

答案 0 :(得分:2)

除了第一个salary之后缺少的逗号,你所拥有的就好了。你不需要围绕HAVING子句的括号,但我无法想象解析器在乎:

SELECT salary, COUNT(salary) AS NumberOfTimes
FROM person
GROUP BY salary
HAVING COUNT(salary) > 1

答案 1 :(得分:0)

在“salary”和“COUNT(salary)”之间添加逗号。