# Merge 6 business detail tables from different scenarios (group, pd, socialzone, social_scene, profile_page, group (HiveSQL)

## Prompt
### Task Objective
Merge 6 business detail tables from different scenarios using UNION ALL after date filtering, writing the results into a unified detail partitioned table.

### Inputs
- `internal_platform_db.dwd_im_ads_businesses_core_scene_detail_group_di_query_engine_142`
- `internal_platform_db.dwd_im_ads_businesses_core_scene_detail_pd_di_query_engine_142`
- `internal_platform_db.dwd_im_ads_businesses_core_scene_detail_social_di_query_engine_142`
- `internal_platform_db.dwd_im_ads_businesses_core_scene_detail_social_scene_di_query_engine_142`
- `internal_platform_db.dwd_im_ads_businesses_core_scene_detail_profile_page_di_query_engine_142`
- `internal_platform_db.dwd_im_ads_businesses_core_scene_detail_group_profile_di_query_engine_142`

### Processing Rules
1. No joins, single-table processing
2. Filter condition: `imp_date = 20260608` for all tables
3. Field alignment rules:
   - 5 tables (group, socialzone, social_scene, profile_page, group_profile) use `SELECT *` to output all 13 fields
   - The `pd` table has 15 fields; explicitly list the first 13 fields: `imp_date`, `appid`, `message_id`, `puin`, `code`, `group_no`, `scene`, `sub_scene`, `hit_msg`, `is_punish_beat`, `new_reg_tag`, `payload_req`, `reg_date` (excluding the trailing `strategy_id` and `strategy_status`)
4. Merge all results using UNION ALL, without deduplication

### Output Requirements
Output field order: `imp_date`, `appid`, `message_id`, `puin`, `code`, `group_no`, `scene`, `sub_scene`, `hit_msg`, `is_punish_beat`, `new_reg_tag`, `payload_req`, `reg_date`

### Write Requirements
- Target table: `internal_platform_db.dwd_im_ads_businesses_core_scene_detail_di_cand_query_engine_142`
- Write method: `INSERT OVERWRITE`
- Partition field: `imp_date = 20260608`

Please write the final HiveSQL to `result.sql` and execute it.

## Reference Solution
INSERT OVERWRITE TABLE internal_platform_db.dwd_im_ads_businesses_core_scene_detail_di_query_engine_142 PARTITION (imp_date = 20260608)
select appid, message_id, puin, code, group_no, scene, sub_scene, hit_msg, is_punish_beat, new_reg_tag, payload_req, reg_date
from internal_platform_db.dwd_im_ads_businesses_core_scene_detail_group_di_query_engine_142
where imp_date = 20260608
union all
select appid, message_id, puin, code, group_no, scene, sub_scene, hit_msg, is_punish_beat, new_reg_tag, payload_req, reg_date
from internal_platform_db.dwd_im_ads_businesses_core_scene_detail_pd_di_query_engine_142
where imp_date = 20260608
union all
select appid, message_id, puin, code, group_no, scene, sub_scene, hit_msg, is_punish_beat, new_reg_tag, payload_req, reg_date
from internal_platform_db.dwd_im_ads_businesses_core_scene_detail_social_di_query_engine_142
where imp_date = 20260608
union all
select appid, message_id, puin, code, group_no, scene, sub_scene, hit_msg, is_punish_beat, new_reg_tag, payload_req, reg_date
from internal_platform_db.dwd_im_ads_businesses_core_scene_detail_social_scene_di_query_engine_142
where imp_date = 20260608
union all
select appid, message_id, puin, code, group_no, scene, sub_scene, hit_msg, is_punish_beat, new_reg_tag, payload_req, reg_date
from internal_platform_db.dwd_im_ads_businesses_core_scene_detail_profile_page_di_query_engine_142
where imp_date = 20260608
union all
select appid, message_id, puin, code, group_no, scene, sub_scene, hit_msg, is_punish_beat, new_reg_tag, payload_req, reg_date
from internal_platform_db.dwd_im_ads_businesses_core_scene_detail_group_profile_di_query_engine_142
where imp_date = 20260608