请告诉我如何为以下SQL查询编写LINQ,
Select cr.Id
from [dbo].[User] usr, [dbo].[LikesStaging] lk, [dbo].[ChangeRequestStaging] cr
where usr.CustomerId=lk.[LikedBy] and usr.[Id] = 'user' and lk.[ChangeRequestId] = cr.[Id]
尝试使用以下查询,但无法在我的linq查询中添加usr.[Id] = 'user'
条件。
var result = from usr in lstUser
join lk in lstLikeStaging
on usr.CustomerId equals lk.LikedBy
join cr in lstChangeRequests
on lk.ChangeRequestId equals cr.Id
select new
{
cr.Id
};
请告诉我如何在此处添加此条件。
答案 0 :(得分:0)
var result = from usr in lstUser
join lk in lstLikeStaging on usr.CustomerId equals lk.LikedBy
join cr in lstChangeRequests on lk.ChangeRequestId equals cr.Id
where usr.id=="user"
select new
{
cr.Id
};
答案 1 :(得分:0)
var result = from usr in lstUser
where usr.Id == "user"
join lk in lstLikeStaging
on usr.CustomerId equals lk.LikedBy
join cr in lstChangeRequests
on lk.ChangeRequestId equals cr.Id
select new
{
cr.Id
};