2012-07-15 30 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