我有一个查询
SELECT EmployeeID, sum( Salary *12 ) AS Annual_Salary
FROM Employee
GROUP BY Salary
LIMIT 0 , 30
显示年薪但我想显示2000到6000之间的年薪所以 感谢提前
答案 0 :(得分:2)
SELECT EmployeeID, sum( Salary *12 ) AS Annual_Salary
FROM Employee
GROUP BY Salary
HAVING sum( Salary *12 ) BETWEEN 2000 AND 6000
LIMIT 0 , 30
答案 1 :(得分:2)
SELECT EmployeeID, sum( Salary *12 ) AS Annual_Salary
FROM Employee HAVING Annual_Salary BETWEEN 2000 AND 6000
GROUP BY Salary
LIMIT 0 , 30
答案 2 :(得分:0)
使用此:
SELECT temp.* FROM
(SELECT EmployeeID, sum( Salary *12 ) AS Annual_Salary
FROM Employee GROUP BY Salary) as temp
WHERE temp.Anuual_salary > 2000 AND temp.Anuual_salary < 6000