本文介绍了如何在Linq中使用分组和计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在尝试将以下查询从SQL转换为Linq时遇到了麻烦,尤其是在查询中具有count和group by的情况下:
I am having trouble trying to convert the following query from SQL to Linq, in particular with the having count and group by parts of the query:
select pa.ProjectID
from ProjectAssociation pa
where pa.TeamID in ( select TeamID
from [User]
where UserID in (4))
group by pa.ProjectID
having COUNT(pa.TeamID) = (select distinct COUNT(TeamID)
from [User]
where UserID in (4))
有关如何执行此操作的任何建议将不胜感激:)
Any advice on how to do so would be much appreciated :)
推荐答案
这篇关于如何在Linq中使用分组和计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!