日期:2014-05-20  浏览次数:20822 次

请问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
手写,不知道对不对