写掉了点东西: update tableA a set (a.name,a.d_date) = (select b.name,b.d_date from tableB b where b.ID=a.ID and b.d_date>a.d_date)
update tableA set (tableA.name , tableA.d_date) = (select tableB.name, tableB.d_date from tableB where tableA.id = tableB.id ) where exists (select 1 from tableB where tableA.id = tableB.id and tableB.d_date > tableA.d_date)
to outwindows(水花): 不加条件更新的话,b.d_date <= a.d_date 的纪录会被更新成null值
update tableA a
set (a.name,a.d_date) = (select b.name,b.d_date from tableB b
where b.ID=a.ID and b.d_date>a.d_date)
set (tableA.name , tableA.d_date) =
(select tableB.name, tableB.d_date from tableB where tableA.id = tableB.id )
where exists
(select 1 from tableB where tableA.id = tableB.id and tableB.d_date > tableA.d_date)
不加条件更新的话,b.d_date <= a.d_date 的纪录会被更新成null值