我的SQL代码如下:LINQ相当于SQL查询 “不在(选择查询)”
select UserId,UserName
from aspnet_Users
where UserId not in (select UsersId from tbluser where active='true')
什么是等效的LINQ表达?
我的SQL代码如下:LINQ相当于SQL查询 “不在(选择查询)”
select UserId,UserName
from aspnet_Users
where UserId not in (select UsersId from tbluser where active='true')
什么是等效的LINQ表达?
我第一次尝试使用LiNQ
在C#
var result = from y in aspnet_Users
where !(
from x in tblUser
where x.active == "true"
select x.UsersID
).Contains(y.UserId)
select y;
-- OR // select new { y.UserId, y.UserName};
SOURCE
我认为它应该是'x.active' –
@Sahuagin是的,谢谢。 –
+1。 –
var query =
from c in aspnet_Users
where !(from o in tbluser where o.active=="true"
select o.UserId)
.Contains(c.UserId)
select c;
你的**副本与@JW答案有什么不同? –
我没有观察@jw的答案,发布我的答案后,我才知道两者都是一样的。 – LNRao
'where!aspnet_Users.Any(p => p.active ==“true”)'看起来不一样。我在这里错过了什么吗? –
!。载有()或。除()是两种方式我m在'VB'或'C#'中知道 – dougajmcdonald
? –