我有一个临时表#People
,其中包含以下内容:
PersonnelId, TaskId
200 40
200 41
200 **42**
300 **42**
300 45
400 41
400 **42**
400 60
所以注意42在所有三组人员中都存在。
我该如何写一个查询来为我找到这个42?
该查询将获取所有personId中存在的taskid。
Select taskid
From tbl
Group by taskid
Having count(distinct PersonnelId) =
(select count(distinct PersonnelId) from tbl)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句