update aim_place_position set front_level_id = null where id in (select id from (select a1.id from aim_place_position a1 left join aim_place_position a2 on a1.front_level_id = a2.id where a1.front_level_id is not null and a2.id is null) t); update land_mark set front_level_id = null where id in (select id from (select a1.id from land_mark a1 left join land_mark a2 on a1.front_level_id = a2.id where a1.front_level_id is not null and a2.id is null) t); update area_info set template_id = null where id in (select id from (select area_info.id from area_info left join aim_group_info on area_info.template_id = aim_group_info.id where area_info.template_id is not null and aim_group_info.id is null) t); update thing_info set template_id = null where id in (select id from (select thing_info.id from thing_info left join aim_group_info on thing_info.template_id = aim_group_info.id where thing_info.template_id is not null and aim_group_info.id is null) t);