2012-07-15 31 views
0

请构成了MySQL查询LINQ查询SQL到LINQ转换与NOT IN

select a.name ,a.amount 
from acount as a 
where a.acountid NOT IN (select c.id from saving as c where c.userid="x") 
and a.userid="x"; 
X=1; 

请帮我 感谢

+0

你需要这个查询的linq表达式吗? – 2012-07-15 17:03:50

+0

是的,我需要一个LINQ表达式 – Anjana 2012-07-15 17:59:23

回答

3

可言,但在东西这些行应该工作没有测试.. 。

var query =  
    from a in db.Account 
    where !(from s in db.Savings 
      where s.UserId == "x" 
      select s.id)  
      .Contains(a.AccountId)  
    && a.UserId == "x" 
    select new { a.Name, a.Amount }; 
+0

非常感谢它:)... – Anjana 2012-07-15 18:13:48