-4
如何在實體框架中編寫此查詢?如何在實體框架中使用兩次表?
SELECT * FROM [Account]
where [Account].[AccountID] not in (select [Account].[ParentID] from [Account])
如何在實體框架中編寫此查詢?如何在實體框架中使用兩次表?
SELECT * FROM [Account]
where [Account].[AccountID] not in (select [Account].[ParentID] from [Account])
一種方式來做到這一點是這樣的:
from a in db.Account
where !db.Account.Any(a2 => a2.ParentID == a.AccountID)
select a;