编写特殊的linq查询 [英] Writing special linq query
本文介绍了编写特殊的linq查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我如何通过linq编写followingin tsql查询:
Hi
How can I write the followin tsql query by linq:
Select * From employees where EmployeeId not in(select EmployeeId from Orders)
谢谢
推荐答案
通常,您可以使用 Linqer [
Generally you can use Linqer[^] to convert any SQL statement to LINQ.
For your question the tsql will look like this.
var query =
from e in Employees
where !(from o in Orders
select o.EmployeeID)
.Contains(e.EmployeeID)
select e;
希望对您有帮助.
I hope this helps you well.
这篇关于编写特殊的linq查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文