C# 带2的Linq语句连接一个where并需要计数
这就是我所拥有的:C# 带2的Linq语句连接一个where并需要计数,c#,linq,join,count,where,C#,Linq,Join,Count,Where,这就是我所拥有的: var count = (from p in _db.Personen join pc in _db.Postcodes on p.Postcode equals pc.postcode join r in _db.Regios on pc.RegioId equals r.RegioId where (p.Leeftijd >
var count = (from p in _db.Personen
join pc in _db.Postcodes on p.Postcode equals pc.postcode
join r in _db.Regios on pc.RegioId equals r.RegioId
where (p.Leeftijd >= leeftijdgetal[0] && leeftijd[1] <= p.Leeftijd) &&
r.RegioNaam == regio && p.Geslacht == geslacht
select new
{
teller = Where(p => p.Showit == 1).Count()
}).Distinct();
var count=(来自p in_db.Personen
将pc加入p上的db.邮政编码。邮政编码等于pc.邮政编码
在pc上的_db.Regios中加入r.RegioId等于r.RegioId
其中(p.Leeftijd>=leeftijdgetal[0]&&Leeftijd[1]p.Showit==1.Count()
}).Distinct();
它给出纳员一个错误。
我怎样才能接收到2个年龄段、具有特定地区和特定性别的所有人的数量
各表如下:
个人:
var count = (from p in _db.Personen
join pc in _db.Postcodes on p.Postcode equals pc.postcode
join r in _db.Regios on pc.RegioId equals r.RegioId
where (p.Leeftijd >= leeftijdgetal[0] && leeftijd[1] <= p.Leeftijd) &&
r.RegioNaam == regio && p.Geslacht == geslacht
select new
{
teller = Where(p => p.Showit == 1).Count()
}).Distinct();
-人形
-纳姆
-沃纳姆
-利夫蒂德
-格斯拉赫特
-阿迪斯
-邮政编码
-Telefoon
-电子邮件
-瓦赫特伍德
-罗利德
-弗拉根利斯蒂德
-地位
-曼特维尔佐格里德
-多克特里德
-开斋节
邮政编码:
var count = (from p in _db.Personen
join pc in _db.Postcodes on p.Postcode equals pc.postcode
join r in _db.Regios on pc.RegioId equals r.RegioId
where (p.Leeftijd >= leeftijdgetal[0] && leeftijd[1] <= p.Leeftijd) &&
r.RegioNaam == regio && p.Geslacht == geslacht
select new
{
teller = Where(p => p.Showit == 1).Count()
}).Distinct();
-邮政编码
-吉米内特
-区域性
-邮政编码
地区:
var count = (from p in _db.Personen
join pc in _db.Postcodes on p.Postcode equals pc.postcode
join r in _db.Regios on pc.RegioId equals r.RegioId
where (p.Leeftijd >= leeftijdgetal[0] && leeftijd[1] <= p.Leeftijd) &&
r.RegioNaam == regio && p.Geslacht == geslacht
select new
{
teller = Where(p => p.Showit == 1).Count()
}).Distinct();
-区域性
-RegioNaam在我看来,这里根本不需要投影
var count = (from p in _db.Personen
join pc in _db.Postcodes on p.Postcode equals pc.postcode
join r in _db.Regios on pc.RegioId equals r.RegioId
where p.Leeftijd >= leeftijdgetal[0] && leeftijd[1] <= p.Leeftijd &&
r.RegioNaam == regio &&
p.Geslacht == geslacht &&
p.Showit == 1
)
.Distinct()
.Count();
var count=(来自p in_db.Personen
将pc加入p上的db.邮政编码。邮政编码等于pc.邮政编码
在pc上的_db.Regios中加入r.RegioId等于r.RegioId
其中p.Leeftijd>=leeftijdgetal[0]&&Leeftijd[1]在teller
上失败,因为where(p=>p.Showit==1).Count()
是无效语法,where
需要在可枚举项上调用(此处没有)。