我尝试添加“ HAVING Number> 1”,但是它不能正常工作,只能输出1行
SELECT
T.EmployeeID,
COUNT(*) AS "Number"
FROM (
SELECT
Skill.Title,
Skill.SkillID,
EmployeeSkill.EmployeeID
FROM Skill
RIGHT JOIN EmployeeSkill ON EmployeeSkill.SkillID = Skill.SkillID
) T
GROUP BY T.EmployeeID
答案 0 :(得分:0)
我相信,如果您使用“具有count(*)> 1”而不是“具有number> 1”,它应该可以工作
答案 1 :(得分:0)
如果您只想从查询中找到Number > 1
那么您需要在该语句中添加一个HAVING子句:
HAVING COUNT(*) > 1
答案 2 :(得分:0)
我怀疑您正在寻找至少具有两种技能的员工。如果是这样,那似乎是对表EmployeeSkill
的简单汇总查询,例如:
SELECT EmployeeID, COUNT(*)
FROM EmployeeSkill
GROUP BY EmployeeID
HAVING COUNT(*) > 1