select sr.Name as Sale_Rep,ag.Name as Agent ,
sum(tr.Amount) Debit_tran
from DebtorTransactions as tr
join Warranty as wr on tr.ProductID=wr.Id
join Agents as ag on ag.pkfAgentID=wr.fldAgentID
join SalesReps as sr on wr.fldSrId =sr.pkfSrID
where tr.Product=0
group by ag.Name, sr.Name
我想将此查询转换为 Linq 到实体,但不能...有人可以将此查询转换为 Linq 到我的实体吗?
这是我尝试过的:
var abc= from tr in db.DebtorTransactions
from wr in db.Warranties
from sr in db.SalesReps
from ag in db.Agents
where tr.ProductID==wr.Id
&& ag.pkfAgentID==wr.fldAgentID
&& wr.fldSrId ==sr.pkfSrID
&& tr.Product==0
select new { ag.Name, sr.Name, tr.Amount };
但我没有得到任何输出