select *
from impact
where (usedin&1)=1
and impactid not in
(select impactid
from responsetime
where scontractid= scontractid )
我正在学习LINQ。 我想在LINQ中编写此查询。
答案 0 :(得分:1)
我告诉我这样的SQL查询会更快。
select *
from impact i
left outer join responsetime r on i.impactid = r.impactid
where (usedin&1)=1
and scontractid= scontractid
and r.impact is null
将其转换为linq,我们得到:
from i in impact
from r in responsetime.Where(rr=>i.impactid = rr.impactid).DefaultIfEmpty()
where (i.usedin&1)=1
and i.scontractid= scontractid
and r.impact is null
select i