如何将以下sql查询更改为Linq查询

时间:2014-12-30 05:43:32

标签: sql linq

如何将以下sql查询更改为Linq查询

select [like] 
from FacebookLikes 
where FacebookLikeCategoryID in (select FacebookLikeCategoryID 
                                 from FacebookLikeCategories 
                                 where UserID = 18)

1 个答案:

答案 0 :(得分:0)

var inner = from cid in FacebookLikeCategories where cid.UserID = 18 select cid.FacebookLikeCategoryID;
var result = from res in FacebookLikes where inner.Contains(res.UserID) select res.[like];