未名Q

此生若能得幸福安稳,谁又愿颠沛流离。

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: :: 订阅 订阅 :: 管理 ::

oracle 多列=多列

https://www.cnblogs.com/hijushen/p/4273929.html
https://blog.csdn.net/hello__word__/article/details/88354694

多列更新

UPDATE WMS_CUSTOMER_CONFIG C
   SET (C.WORK_DESCRIPTION,
        C.S_IS_GROUP_OLD_ITEM,
        C.S_IS_GROUP_ITEM_CODE,
        C.S_IS_GROUP_LOT,
        C.S_IS_GROUP_ORDER_CODE,
        C.S_IS_GROUP_PD,
        C.S_IS_GROUP_LD) =
       (SELECT T.WORK_DESCRIPTION,
               T.S_IS_GROUP_OLD_ITEM,
               T.S_IS_GROUP_ITEM_CODE,
               T.S_IS_GROUP_LOT,
               T.S_IS_GROUP_ORDER_CODE,
               T.S_IS_GROUP_PD,
               T.S_IS_GROUP_LD
          FROM TEMP_CONFIG T
         WHERE T.ID = C.ID)
WHERE C.ID = (SELECT T.ID FROM TEMP_CONFIG T WHERE T.ID = C.ID);
WHERE EXISTS (SELECT T.ID FROM TEMP_CONFIG T WHERE T.ID = C.ID);
 
 
多列 in 条件
SELECT C.ID,
       C.S_IS_GROUP_OLD_ITEM,
       C.S_IS_GROUP_ITEM_CODE,
       C.S_IS_GROUP_LOT,
       C.S_IS_GROUP_ORDER_CODE,
       C.S_IS_GROUP_PD,
       C.S_IS_GROUP_LD
  FROM WMS_CUSTOMER_CONFIG C
WHERE (C.S_IS_GROUP_OLD_ITEM, C.S_IS_GROUP_ITEM_CODE, C.S_IS_GROUP_LOT,
        C.S_IS_GROUP_ORDER_CODE, C.S_IS_GROUP_PD, C.S_IS_GROUP_LD) IN
       (SELECT T.S_IS_GROUP_OLD_ITEM,
               T.S_IS_GROUP_ITEM_CODE,
               T.S_IS_GROUP_LOT,
               T.S_IS_GROUP_ORDER_CODE,
               T.S_IS_GROUP_PD,
               T.S_IS_GROUP_LD
          FROM TEMP_C T);

多列 = 条件 ,限制select返回仅1条记录

SELECT C.ID,
       C.S_IS_GROUP_OLD_ITEM,
       C.S_IS_GROUP_ITEM_CODE,
       C.S_IS_GROUP_LOT,
       C.S_IS_GROUP_ORDER_CODE,
       C.S_IS_GROUP_PD,
       C.S_IS_GROUP_LD
  FROM WMS_CUSTOMER_CONFIG C
WHERE (C.S_IS_GROUP_OLD_ITEM, C.S_IS_GROUP_ITEM_CODE, C.S_IS_GROUP_LOT,
        C.S_IS_GROUP_ORDER_CODE, C.S_IS_GROUP_PD, C.S_IS_GROUP_LD) =
       (SELECT T.S_IS_GROUP_OLD_ITEM,
               T.S_IS_GROUP_ITEM_CODE,
               T.S_IS_GROUP_LOT,
               T.S_IS_GROUP_ORDER_CODE,
               T.S_IS_GROUP_PD,
               T.S_IS_GROUP_LD
          FROM TEMP_C T WHERE ID=4041);

 

 

update join 的使用

update (select loc.remain_pallet,
               c.pallet_limit,
               loc.REMAIN_VOLUME,
               c.volume_Limit,
               loc.REMAIN_WEIGHT,
               c.weight_Limit,
               loc.remain_pass_box,
               c.pass_box_limit,
               loc.REMAIN_DISK,
               c.disk_limit
          from wms_location loc
          left join wms_location_capacity c on c.id = loc.LOCATION_CAPACITY_ID)
   set REMAIN_VOLUME = volume_Limit,
       REMAIN_WEIGHT = weight_Limit,
       REMAIN_PALLET = pallet_Limit,
       REMAIN_PASS_BOX = pass_box_limit,
       REMAIN_DISK = disk_limit;
posted on 2020-08-27 21:29  未名Q  阅读(1877)  评论(0编辑  收藏  举报