当前位置:Gxlcms > 数据库问题 > sql 与linq的转换

sql 与linq的转换

时间:2021-07-01 10:21:17 帮助过:2人阅读

t.[MINTAccountIdentifier] from BSS_Tenant t left join BL_SAPCustomer s on s.BillableAccountID=t.MINTAccountIdentifier where s.CustomerID is null;


转化的linq

from t in entities.BSS_Tenant
 join s in entities.BL_SAPCustomer on t.MINTAccountIdentifier equals s.BillableAccountID into osy
  from os in osy.DefaultIfEmpty()
  where os.CustomerID == null
  select t.MINTAccountIdentifier;

生成的sql

SELECT 
    [Extent1].[MINTAccountIdentifier] AS [MINTAccountIdentifier]
    FROM  [dbo].[BSS_Tenant] AS [Extent1]
    LEFT OUTER JOIN [dbo].[BL_SAPCustomer] AS [Extent2] ON [Extent1].[MINTAccountIdentifier] = [Extent2].[BillableAccountID]
    WHERE [Extent2].[CustomerID] IS NULL


 

 

sql 与linq的转换

标签:

人气教程排行