-- 同步日期,没有create_time的要新增字段UPDATE act_ge_bytearray as a leftjoin`act_hi_varinst`as b on a.ID_=b.BYTEARRAY_ID_ set a.create_time=b.CREATE_TIME_ where!ISNULL(b.BYTEARRAY_ID_);UPDATE`act_hi_identitylink`as a leftjoin(SELECT START_TIME_, PROC_INST_ID_ FROM act_hi_actinst GROUPBY PROC_INST_ID_ )as b on a.PROC_INST_ID_=b.PROC_INST_ID_ set a.create_time=b.START_TIME_ where ISNULL(a.create_time)and!ISNULL(a.PROC_INST_ID_);UPDATE`act_hi_identitylink`as a leftjoin(SELECT START_TIME_, TASK_ID_ FROM act_hi_actinst GROUPBY TASK_ID_ )as b on a.TASK_ID_=b.TASK_ID_ set a.create_time=b.START_TIME_ where ISNULL(a.create_time)and!ISNULL(a.TASK_ID_);update act_ru_execution AS a LeftJOIN act_ru_task AS b ON a.PROC_INST_ID_ = b.PROC_INST_ID_ set a.create_time=b.CREATE_TIME_ where isnull(a.create_time);update act_ru_variable AS a LeftJOIN act_ru_task AS b ON a.PROC_INST_ID_ = b.PROC_INST_ID_ set a.create_time=b.CREATE_TIME_ where isnull(a.create_time);UPDATE act_ge_bytearray as a leftjoin`act_ru_variable`as b on a.ID_=b.BYTEARRAY_ID_ set a.create_time=b.create_time where!ISNULL(b.BYTEARRAY_ID_);UPDATE act_ru_identitylink AS a LEFTJOIN act_ru_task AS b ON a.TASK_ID_ = b.ID_ SET a.create_time = b.CREATE_TIME_ WHERE!isnull( a.TASK_ID_ );UPDATE act_ru_identitylink AS a LEFTJOIN(SELECT CREATE_TIME_,PROC_INST_ID_ from act_ru_task groupby PROC_INST_ID_)AS b ON a.PROC_INST_ID_ = b.PROC_INST_ID_ SET a.create_time = b.CREATE_TIME_ WHERE ISNULL( a.create_time)and!ISNULL(a.PROC_INST_ID_);-- 按次序删除,有外键关联DELETEFROM act_ru_variable whereYEAR(create_time)=2021;DELETEFROM act_ge_bytearray whereYEAR(create_time)=2021;DELETEFROM act_hi_actinst whereYEAR(START_TIME_)=2021;DELETEFROM act_hi_comment whereYEAR(TIME_)=2021;DELETEFROM act_hi_identitylink whereYEAR(create_time)=2021;DELETEFROM act_hi_procinst whereYEAR(START_TIME_)=2021;DELETEFROM act_hi_taskinst whereYEAR(START_TIME_)=2021;DELETEFROM act_hi_varinst whereYEAR(CREATE_TIME_)=2021;DELETEFROM act_ru_identitylink whereYEAR(create_time)=2021;DELETEFROM act_ru_task whereYEAR(CREATE_TIME_)=2021;DELETEFROM act_ru_execution whereYEAR(create_time)=2021;