zoukankan      html  css  js  c++  java
  • sql关联更新

    /****** Script for SelectTopNRows command from SSMS ******/
    SELECT * FROM [LFBMP.Operating].[dbo].[ShoppingOrder]
    --更新ShoppingOrder
    -- update [LFBMP.Operating].[dbo].[ShoppingOrder] set ContainerTypeID=t1.ContainerTypeID,[ContainerTypeStr]=t1.[ContainerTypeStr] From [LFBMP.Operating].[dbo].[BusinessOrder] as t1,[LFBMP.Operating].[dbo].[ShoppingOrder] as t2 where t1.B_ID=t2.B_ID

    --更新bookingOrder
    --update [LFBMP.Operating].[dbo].[BookingOrder] set state=t3.state From [LFBMP.Operating].[dbo].[BusinessOrder] as t1 ,[LFBMP.Operating].[dbo].[BookingOrder] as t2 ,[LFBMP.Operating].[dbo].[BookingScheme] as t3 where t2.BS_ID=t3.BS_ID and t1.B_ID=t3.B_ID

    UPDATE Table1 AS t1
    SET (Field1,Field2) = (SELECT Field21, Field22
    FROM Table2 t2
    INNER JOIN Table3 t3
    ON t3.Field31 = t2.Field23
    INNER JOIN Table4 t4
    ON t3.Field32 = t4.Filed41
    WHERE t2.Field24 >= ''
    AND t1.fId = t4.fId);

    SELECT
    [B_ID],[CommissionCompanyID],[ShippingOrderNo],[ShipperID]
    ,(SELECT [C_DisplayFormat] FROM [LFBMP.CRM].[dbo].[CRM.Company] Where [C_ID]=[ShipperID]) as [Shipper]
    ,[ConsigneeID]
    ,(SELECT [C_DisplayFormat] FROM [LFBMP.CRM].[dbo].[CRM.Company] Where [C_ID]=[ConsigneeID]) as [Consignee]
    ,[NotifyID]
    ,(SELECT [C_DisplayFormat] FROM [LFBMP.CRM].[dbo].[CRM.Company] Where [C_ID]=[NotifyID]) as [Notify]
    ,[PortOfLoadingID],[PortOfSransshipmentID],[PortOfDischargeID],[FinalDestinationID],[CommissioItemStr],[HBPaymentTerm],[HBPaymentTermPlace],[ContainerTypeID],[ContainerTypeStr],[CarrierID],[ClaimETD],[HBLoadingTermID],[Adder]
    FROM [LFBMP.Operating].[dbo].[BusinessOrder]

  • 相关阅读:
    水煮栗子
    张至顺道长羽化登仙+说修行(道经每日清修)
    治疗口腔溃疡的穴位按摩方法
    一年四季的时令蔬菜水果表
    坐式养生八段锦口诀及练法图解
    SOA建设规划
    生鲜电商业务流程规划
    产品定义到产品推广的思路
    生鲜财务核算
    税率与存货、供应商关系
  • 原文地址:https://www.cnblogs.com/q149072205/p/5585209.html
Copyright © 2011-2022 走看看