我试图在LINQ中为两个表创建一个左连接,但其中一个表需要一个常量的连接值。
纯SQL中的查询是
select
cf.idCreditForm ,q3.FacturadaenSAP
from
Panacredit.dbo.pet_CreditForm cf
left join
Panacredit.dbo.cat_customentity_crediqcr3 q3 on cf.idCreditForm = q3.IdEntityItem
and q3.IdType = 7
where
cf.opStatus = 6
and cf.idSubStatus = 72
到目前为止,我的LINQ代码是
solicitudes =
from sol in ElContexto.pet_CreditForms
join cq3 in ElContexto.cat_customentity_crediqcr3s
on new { sol.idCreditForm, 7 } = new { cq3.IdEntityItem , cq3.IdType }
into solicCq3
where sol.approvedDate >= iniDateJul
&& sol.approvedDate <= endDateJul
&& sol.opStatus == 6
&& sol.idCompany == idcompany
&& sol.idSubStatus == subEst
&& sol.idBranch == idbranch
from scq3 in solicCq3.DefaultIfEmpty()
select new { sol.idCreditForm , cq3.FacturadaenSAP };
请帮帮我
答案 0 :(得分:0)
q3.IdType = 7
部分与联接无关。将其移至where子句。