查询数据计数列数据SQL

时间:2019-05-11 06:56:15

标签: sql

enter image description here

我有桌子人,我只想要结果Departement

我拥有2个以上的工程师级。

我正在尝试这样的查询

SELECT
    Department, Level
FROM
    people 
WHERE 
    Level = 'Engineer' 
HAVING 
    (Level = 'Engineer' > 2)

但没有结果,请帮助我

1 个答案:

答案 0 :(得分:4)

您缺少GROUP BYCOUNT(Level) > 2。查询将是:

SELECT Department
FROM people 
WHERE Level = 'Engineer' 
GROUP BY Department
HAVING COUNT(Level) > 2