1、被update主表一定要加上过滤条件。
2、查询出来更新结果集,同时也要作为被更新主表的条件,作为同步大家都是更新这部分数据。
update student stu
set (stu.name,stu.sex) =
(select bak.name,bak.sex
from student_bak bak
where bak.id = stu.id
and stu.age = 20
)
where exists (select 1
from student_bak bak
where bak.id = stu.id
and stu.age = 20
)
3.日期格式:
to_date('2019-5-1 00:00:01','yyyy-mm-dd hh24:mi:ss');