我有以下两个表:
-Groups-
Id
Name
-Members-
Id
GroupId (Group.Id is related to Member.GroupId)
Name
IsActive (bit)
如何编写一个 LINQ 查询,该查询将按组中 IsActive 成员的数量从高到低排序?
查询看起来像这样
//pseudo code
from grp in database.Groups
orderby Count(grp.Members.where(m=>m.IsActive == true)) descending
select grp