使用VS 2013(VB)。
我有以下linq查询
Dim countCompanies = (From num In db.GasEmailAddresses
Group Join GCC In db.GasCompanies
On num.CompanyID Equals GCC.ID
Into GCComp = Group
Select num.CompanyID).Distinct.Count
返回4个结果。我想在
的行中添加一个where子句WHERE GCC.Active = 1
我现在一直在搞乱这段代码,似乎无法让它发挥作用。
有什么想法吗?
--- --- UPDATE
基于建议的修改代码
Dim countCompanies = (From num In db.GasEmailAddresses
Group Join GCC In db.GasCompanies.Where(Function(y) y.Active = 1)
On num.CompanyID Equals GCC.ID
Into GCComp = Group
Select num.CompanyID).Distinct.Count
答案 0 :(得分:0)
在检索数据源时尝试过滤: -
companies.Where(Function(x) x.Active = 1)