delete from ur_task_dw_rpt where rpt_id = '013C126F1D4642FE9BBDA0A2E03EB1D6' 
and dw_id in (select dw_id from ur_sys_dw where dw_type != '1');

delete from ur_task_dw_rpt where rpt_id = 'B8FE3F5C7D3F43E1B36E13AA6F6684FA' 
and dw_id in (select dw_id from ur_sys_dw where dw_type != '1');

delete from ur_task_dw_rpt where rpt_id = '39867EDFD0CF49E4B783C586EF6BF72F' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('21','22','23','41','92','99'));

delete from ur_task_dw_rpt where rpt_id = 'EEA9AD2D1A9844C5A3A6B2ADE60EDF5B' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('21','22','23','41','92','99'));

delete from ur_task_dw_rpt where rpt_id = 'C4A18F1159DE4AC9A8F13D18E53C6EAD' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt where rpt_id = 'FB0A23CA6D2D4B4AAFA7567DE11EACB3' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt where rpt_id = 'BDBF0A0B4EC34A379AB97A0A6EF88B00' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt where rpt_id = 'B3C2C7ADFA4440CE990CBE321E1AEBA8' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt where rpt_id = 'E9EBEDD3F27945D1B3E01766A8B02356' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk where rpt_id = '013C126F1D4642FE9BBDA0A2E03EB1D6' 
and dw_id in (select dw_id from ur_sys_dw where dw_type != '1');

delete from ur_task_dw_rpt_chk where rpt_id = 'B8FE3F5C7D3F43E1B36E13AA6F6684FA' 
and dw_id in (select dw_id from ur_sys_dw where dw_type != '1');

delete from ur_task_dw_rpt_chk where rpt_id = '39867EDFD0CF49E4B783C586EF6BF72F' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('21','22','23','41','92','99'));

delete from ur_task_dw_rpt_chk where rpt_id = 'EEA9AD2D1A9844C5A3A6B2ADE60EDF5B' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('21','22','23','41','92','99'));

delete from ur_task_dw_rpt_chk where rpt_id = 'C4A18F1159DE4AC9A8F13D18E53C6EAD' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk where rpt_id = 'FB0A23CA6D2D4B4AAFA7567DE11EACB3' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk where rpt_id = 'BDBF0A0B4EC34A379AB97A0A6EF88B00' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk where rpt_id = 'B3C2C7ADFA4440CE990CBE321E1AEBA8' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk where rpt_id = 'E9EBEDD3F27945D1B3E01766A8B02356' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk_reason where rpt_id = '013C126F1D4642FE9BBDA0A2E03EB1D6' 
and dw_id in (select dw_id from ur_sys_dw where dw_type != '1');

delete from ur_task_dw_rpt_chk_reason where rpt_id = 'B8FE3F5C7D3F43E1B36E13AA6F6684FA' 
and dw_id in (select dw_id from ur_sys_dw where dw_type != '1');

delete from ur_task_dw_rpt_chk_reason where rpt_id = '39867EDFD0CF49E4B783C586EF6BF72F' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('21','22','23','41','92','99'));

delete from ur_task_dw_rpt_chk_reason where rpt_id = 'EEA9AD2D1A9844C5A3A6B2ADE60EDF5B' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('21','22','23','41','92','99'));

delete from ur_task_dw_rpt_chk_reason where rpt_id = 'C4A18F1159DE4AC9A8F13D18E53C6EAD' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk_reason where rpt_id = 'FB0A23CA6D2D4B4AAFA7567DE11EACB3' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk_reason where rpt_id = 'BDBF0A0B4EC34A379AB97A0A6EF88B00' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk_reason where rpt_id = 'B3C2C7ADFA4440CE990CBE321E1AEBA8' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw_rpt_chk_reason where rpt_id = 'E9EBEDD3F27945D1B3E01766A8B02356' 
and dw_id in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));

delete from ur_task_dw where task_id = 'C576BF58AAC144E2B905A961F006681F'
and not exists(select 1 from ur_task_dw_rpt rpt where ur_task_dw.dw_id = rpt.dw_id and ur_task_dw.task_id = rpt.task_id
         and ur_task_dw.perd_code = rpt.perd_code);
         
delete from ur_task_dw where task_id = '24641D70878B4E05B403F68DBDD9A44B'
and not exists(select 1 from ur_task_dw_rpt rpt where ur_task_dw.dw_id = rpt.dw_id and ur_task_dw.task_id = rpt.task_id
         and ur_task_dw.perd_code = rpt.perd_code);

delete from UR_DA_ZCFZB_XZ_01 where dw in (select dw_id from ur_sys_dw dw where dw_type != '1');
delete from UR_DA_ZCFZB_SY_01 where dw in (select dw_id from ur_sys_dw dw where dw_type not in ('21','22','23','41','92','99'));
delete from UR_DA_ZCFZB_GS_01 where dw in (select dw_id from ur_sys_dw dw where dw_type not in ('3','42','91'));
delete from ur_da_szzb_xz_01 where dw in (select dw_id from ur_sys_dw dw where dw.dw_type != '1');
delete from ur_da_szzb_sy_01 where dw in (select dw_id from ur_sys_dw dw where dw_type not in ('21','22','23','41','92','99'));
delete from ur_da_lrb_01 where dw in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));
delete from ur_da_xjllb_01 where dw in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));
delete from ur_da_syzqy_01 where dw in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));
delete from ur_da_syzqy_02 where dw in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));
delete from ur_da_zcgc_01 where dw in (select dw_id from ur_sys_dw where dw_type not in ('3','42','91'));
