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

SQL 的not in 怎么转化成LINQ ?泪奔求高手解答!!!!!
有高手吗
C# code
select * from QY_Business where BusinessID not in(select OtherBusinessID from QY_BusinessAssignConsumePlaceDetail) 
怎么转化成Linq?

------解决方案--------------------
探讨

C# code

var query = QY_Business.Where(x => !QY_BusinessAssignConsumePlaceDetail.Contains(x.BusinessID));

------解决方案--------------------
C# code

var result=from u in db. QY_Business
           let n =QY_BusinessAssignConsumePlaceDetail.select(c=>c.OtherBusinessID )
           where !n.Contains(u.BusinessID)
           select u;