批量更新,SQL 优化,在线=
主要是时间段那,请将优化后的结果贴出,在线等,即时采用即时给分,谢谢!
update Eit a set
(user_id, full_name, sex, birthday, native_place, duty_code, job_code, company_id, dept_id, email, mobile, phone, update_date, ehr_pk_psndoc, user_type, his_stats )
=
(
select
user_id, full_name, sex, TO_DATE(birthday, 'YYYY-MM-DD'), native_place,dutycode, job_code, company_id, dept_id, email, mobile, phone, sysdate, ehr_pk_psndoc, '0', '1'
from v_ehr_eit_users b
where b.user_name=a.user_name
and substr(b.update_date,1,10)>='2007-03-01' and substr(b.update_date,1,10)<='2007-03-02'
)
where
exists(
select 1 from v_ehr_eit_users b where b.user_name=a.user_name and substr(b.update_date,1,10)>='2007-03-01' and substr(b.update_date,1,10)<='2007-03-02'
)