我做這個SQL,我現在需要使用此查詢我需要更新T1表給出結果更新語句加入
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'
更新表。
這樣的事情,
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 - 10克
感謝拉利特。作品像一個魅力:) – 2014-11-04 09:19:50