select A.Name,B.UserId
from [dbo].[SentryBoxs] as A
left join [dbo].[SentryBoxUsers] as B on A.ID = B.SentryBoxId
and B.UserId = '970500c2-51bd-443e-ae10-585455f2b326'
如何通过linq实现???
答案 0 :(得分:0)
var ans = from A in dboSentryBoxs
join B in dboSentryBoxUsers on new { A.ID, UserID = "970500c2-51bd-443e-ae10-585455f2b326" } equals new { ID = B.SentryBoxId, B.UserID } into Bjoin
from B in Bjoin.DefaultIfEmpty()
select new { A.Name, B.UserID };