Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT *
- FROM (
- SELECT public.sys_guid(), b.hm_msy043_detail_penerima_reminder_id, a.hm_mem006_workplace_id,
- a.hm_mem004_department_id, b.hm_msy004_user_id, null as email, 0 as version,
- null as user_create, null as creation_time, null as user_modification,
- null as modification_time
- FROM hm_msy043 a
- INNER JOIN hm_msy044 b ON b.hm_msy043_detail_penerima_reminder_id = a.id
- INNER JOIN hm_msy042 c ON c.id = hm_msy042_reminder_id
- WHERE c.type = 'contract'
- UNION
- SELECT public.sys_guid(), b.hm_msy043_detail_penerima_reminder_id, null as hm_msy004_user_id,
- a.hm_mem006_workplace_id, a.hm_mem004_department_id,b.email as email, 0 as version,
- null as user_create, null as creation_time, null as user_modification,
- null as modification_time
- FROM hm_msy043 a
- INNER JOIN hm_msy045 b ON b.hm_msy043_detail_penerima_reminder_id = a.id
- INNER JOIN hm_msy042 c ON c.id = hm_msy042_reminder_id
- WHERE c.type = 'contract'
- ) as a
- ORDER BY a.hm_mem006_workplace_id, a.email
Add Comment
Please, Sign In to add comment