我希望将更新子查询中所选列的值相乘并获得一个新值,如下所示:
来自TAO的新A.GROSS
值A.GROSS
乘以SPLIT文件中选定的B.PERCENT_VALUE
我试过如下:
UPDATE PS_HR_TAO10 A SET A.GROSS = (A.GROSS_AMT * B.PERCENT_VALUE)
(SELECT B.PERCENT_VALUE FROM PS_Z_NEW_FY_SPLIT B
WHERE A.EMPLID = B.EMPLID)
WHERE A.PAY_END_DT = '09-JUL-2016';
答案 0 :(得分:0)
我会选择合并声明:
merge into PS_HR_TAO10 A
using (select EMPLID, PERCENT_VALUE from PS_Z_NEW_FY_SPLIT) B
on (A.EMPLID = B.EMPLID)
when matched then update set
A.GROSS = A.GROSS_AMT * B.PERCENT_VALUE
WHERE A.PAY_END_DT = '09-JUL-2016';