zoukankan      html  css  js  c++  java
  • LIQN join on 后跟多个条件

    sql 版:SELECT [t0].[OrderID], [t0].[CustomerID], [t0].[EmployeeID], [t0].[OrderDate], [t0].[RequiredDate], [t0].[ShippedDate], [t0].[ShipVia], [t0].[Freight], [t0].[ShipName], [t0].[ShipAddress], [t0].[ShipCity], [t0].[ShipRegion], [t0].[ShipPostalCode], [t0].[ShipCountry]
    FROM [Orders] AS [t0]
    INNER JOIN [Order Details] AS [t1] ON ([t0].[OrderID] = [t1].[OrderID]) AND ([t0].[OrderID] = [t1].[OrderID])
    WHERE ([t0].[OrderID] > @p0) AND ([t0].[EmployeeID] = @p1)

     

     LINQ版:from o in Orders  join   od in OrderDetails on  new {oid= o.OrderID,oeid=o.OrderID} equals new {oid=od.OrderID,oeid=od.OrderID }
    where o.OrderID>1000 && o.EmployeeID==5
    select o

     lambda表达式版:

    Orders
       .Join (
          OrderDetails, 
          o => 
             new  
             {
                oid = o.OrderID, 
                oeid = o.OrderID
             }, 
          od => 
             new  
             {
                oid = od.OrderID, 
                oeid = od.OrderID
             }, 
          (o, od) => 
             new  
             {
                o = o, 
                od = od
             }
       )
       .Where (temp0 => ((temp0.o.OrderID > 1000) && (temp0.o.EmployeeID == (Int32?)5)))
       .Select (temp0 => temp0.o)

  • 相关阅读:
    7
    6
    5
    3
    4
    2
    1
    寒假工作经历
    软件工程第三周的总结
    软件工程第三周的学习报告 html<input> final finally finalize 的比较 BigInteger
  • 原文地址:https://www.cnblogs.com/tiancai/p/5035415.html
Copyright © 2011-2022 走看看