如何在linq

时间:2017-03-26 06:00:39

标签: c# mysql linq

我有这个mysql查询做我想要的。但我不知道如何将此查询转换为linq,UNION的一部分让我感到困惑, MYSQL查询:

SELECT * FROM conta.subrecurso as a 
left join conta.recurso as b on a.idRecurso=b.idRecurso
left join conta.eventorecurso as c on b.idRecurso=c.idRecurso
left join conta.recursocliente as d on a.idSubrecurso=d.idSubrecurso
left join conta.eventocliente as e on d.idVenta=e.idVenta
where c.idEvento=47  And  e.idVenta =784
UNION 
SELECT * FROM conta.subrecurso as a 
left join conta.recurso as b on a.idRecurso=b.idRecurso
left join conta.eventorecurso as c on b.idRecurso=c.idRecurso
left join conta.recursocliente as d on a.idSubrecurso=d.idSubrecurso 
left join conta.eventocliente as e on d.idVenta=e.idVenta
WHERE c.idEvento=47 and e.idVenta is null ;

1 个答案:

答案 0 :(得分:1)

有一个类似的question。 在答案中,以这种方式解决了它:

(sqlstatement1).Union(sqlstatement2);