• sql 与linq的转换


    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


     

  • 相关阅读:
    modf()函数
    面向对象编程五大原则
    .Net网络资源
    整理CentOS常用命令
    在RHEL5上安装oracle10gLinux
    strchr()函数
    swab函数
    Strstr()函数
    tmpnam函数
    strdup ()函数
  • 原文地址:https://www.cnblogs.com/sunShineJing/p/4670897.html
Copyright © 2020-2023  润新知