ronaldkwandy

Untitled

Jun 22nd, 2020
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT      *
  2. FROM        (
  3.                 SELECT      public.sys_guid(), b.hm_msy043_detail_penerima_reminder_id, a.hm_mem006_workplace_id,
  4.                             a.hm_mem004_department_id, b.hm_msy004_user_id, null as email, 0 as version,
  5.                             null as user_create, null as creation_time, null as user_modification,
  6.                             null as modification_time
  7.                 FROM        hm_msy043 a
  8.                 INNER JOIN  hm_msy044 b ON b.hm_msy043_detail_penerima_reminder_id = a.id
  9.                 INNER JOIN  hm_msy042 c ON c.id = hm_msy042_reminder_id
  10.                 WHERE       c.type = 'contract'
  11.                 UNION
  12.                 SELECT      public.sys_guid(), b.hm_msy043_detail_penerima_reminder_id, null as hm_msy004_user_id,
  13.                             a.hm_mem006_workplace_id, a.hm_mem004_department_id,b.email as email, 0 as version,
  14.                             null as user_create, null as creation_time, null as user_modification,
  15.                             null as modification_time
  16.                 FROM        hm_msy043 a
  17.                 INNER JOIN  hm_msy045 b ON b.hm_msy043_detail_penerima_reminder_id = a.id
  18.                 INNER JOIN  hm_msy042 c ON c.id = hm_msy042_reminder_id
  19.                 WHERE       c.type = 'contract'
  20.             ) as a
  21. ORDER BY    a.hm_mem006_workplace_id, a.email
Add Comment
Please, Sign In to add comment