a guest Apr 26th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  2.     spriden_pidm pidm,
  3.     spriden_id unum,
  4.     camp.goremal_email_address camp,
  5.     listagg(fnln.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) fnln,
  6.     listagg(pers.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) pers,
  7.     listagg(par.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) par,
  8.     listagg(apc.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) apc,
  9.     listagg(apc.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) recr,
  10.     listagg(alum.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) alum,
  11.     listagg(calb.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) calb,
  12.     listagg(other.goremal_email_address,',') WITHIN GROUP (ORDER BY spriden_pidm) other  
  13. FROM spriden
  14. LEFT JOIN goremal camp ON camp.goremal_pidm = spriden_pidm AND camp.goremal_emal_code = 'CAMP'
  15. LEFT JOIN goremal fnln ON fnln.goremal_pidm = spriden_pidm AND fnln.goremal_emal_code = 'FNLN' AND fnln.goremal_status_ind = 'A'
  16. LEFT JOIN goremal pers ON pers.goremal_pidm = spriden_pidm AND pers.goremal_emal_code = 'PERS' AND pers.goremal_status_ind = 'A'
  17. LEFT JOIN goremal par ON par.goremal_pidm = spriden_pidm AND par.goremal_emal_code IN ('PAR','PAR1','PAR2') AND par.goremal_status_ind = 'A'
  18. LEFT JOIN goremal apc ON apc.goremal_pidm = spriden_pidm AND apc.goremal_emal_code = 'APC' AND apc.goremal_status_ind = 'A'
  19. LEFT JOIN goremal recr ON recr.goremal_pidm = spriden_pidm AND recr.goremal_emal_code = 'RECR' AND recr.goremal_status_ind = 'A'
  20. LEFT JOIN goremal alum ON alum.goremal_pidm = spriden_pidm AND alum.goremal_emal_code = 'ALUM' AND alum.goremal_Status_ind = 'A'
  21. LEFT JOIN goremal calb ON calb.goremal_pidm = spriden_pidm AND calb.goremal_emal_code = 'CALB' AND calb.goremal_status_ind = 'A'
  22. LEFT JOIN goremal other ON other.goremal_pidm = spriden_pidm AND other.goremal_emal_code IN ('BUSI','PCOL','OTHR','EMRG','WEB','SOAR','EM') AND other.goremal_status_ind = 'A'
  23. WHERE spriden_change_ind IS NULL
  24. GROUP BY
  25. spriden_pidm, spriden_id,camp.goremal_email_address
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand