首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

请教linq 语句的写法

2012-05-21 
请问linq 语句的写法请问类似实现 这样效果的 linq 语句怎么写?select *fromtb whereid in (select idfrom

请问linq 语句的写法
请问类似实现 这样效果的 linq 语句怎么写?


select * from tb where id in (select id from tb2 where tb2.id=@id )

[解决办法]
select * from tb where id in (select id from tb2 where tb2.id=@id )
=select * from tb where id=@id
=from i in tb where id==yourid select i
[解决办法]
参考
http://www.csharpwin.com/csharpspace/3899r4152.shtml
[解决办法]

探讨
请问类似实现 这样效果的 linq 语句怎么写?


select * from tb where id in (select id from tb2 where tb2.id=@id )

[解决办法]
var source1=from t in tb2 where t.id=数 select t.id;
var source=from temp in tb where source1.Contains(temp.id) select temp;
[解决办法]
select * from tb where id in (select id from tb2 where tb2.col=@col)

Linq: from t in tb where id.contaict(from c in tb2 where tb2.col=@col) select t
手写,不知道对不对

热点排行