1. left Join

原始sql

select  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


 

 

相关文章:

  • 2021-10-16
  • 2021-07-06
  • 2022-01-24
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-01-19
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-09-17
  • 2022-01-02
相关资源
相似解决方案