【问题标题】:About Linq left join [duplicate]关于Linq左连接[重复]
【发布时间】:2017-09-28 04:36:17
【问题描述】:
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如何实现???

【问题讨论】:

标签: linq


【解决方案1】:
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 };

【讨论】:

    猜你喜欢
    • 2021-05-06
    • 1970-01-01
    • 2015-06-20
    • 2016-03-04
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    相关资源
    最近更新 更多