批量更新A表在B表存在的数据

UPDATE (
SELECT
    w.FORM_NO,wp.CF02,wp.LINE_ITEM_NO,wp.STATUS
FROM
    T_WAREHOUS_PRICE w ,
    T_WAREHOUS_PRICE_DTL wp
WHERE
    w.ID = wp.REF_KEY
    AND wp.IS_DO_PRICE = ''
    AND w.SEND_CODE IN (SELECT DISTINCT SEND_CODE FROM T_ACCOUNT WHERE status='99')
    AND wp.STATUS <> '99'
    AND exists(
    SELECT
        1
    FROM
        T_ACCOUNT a ,
        T_ACCOUNT_DTL ad
    WHERE
        a.ID = ad.REF_KEY
        AND a.STATUS <> '99' AND w.FORM_NO = ad.WAREHOUSE_NO AND wp.LINE_ITEM_NO = ad.CF02 )
    ORDER BY w.FORM_NO ASC , TO_NUMBER(wp.CF02)
) SET STATUS = '2';

 

你可能感兴趣的:(批量更新A表在B表存在的数据)