【发布时间】:2014-12-31 00:55:31
【问题描述】:
我已经创建了这个 sql,我需要用给定的结果更新表
SELECT DISTINCT t1.t1_val3, t1.t1_val4
DECODE (b_val,
'A', 'Its A',
'B', 'Its B',
'C', 'Its C',
NULL
) decode_val,
FROM t1, t2, t3
WHERE t1.t1_val = t2.t2_val
AND t2.t2_val = t3.t3_val
AND t3.t3_val2 <> 'PSA'
AND t3.t3_val2 = 'Y'
现在使用这个查询我需要更新 t1 表。
类似的,
update t1
set
t1.val5=decode_val
where t1.t1_val3= value returned from above query(first column t1_val3)
and t1.t1_val4= value returned from above query(2nd column t1_val4)
DB - 10g
【问题讨论】: