读书人

Linq如何写子查询的语句

发布时间: 2012-04-18 15:01:59 作者: rapoo

Linq怎么写子查询的语句?
SQL中大概这样的

SQL code
select * from 表where id not in( select id from 表 where xxxx)



转换成Linq该怎么写

[解决办法]

C# code
var query = from p in a where !(from p1 in a select p1.id).Contains(p.id) select p
[解决办法]
探讨
SQL中大概这样的


SQL code
select * from 表
where id not in( select id from 表 where xxxx)



转换成Linq该怎么写

读书人网 >.NET

热点推荐