Advertisement
jotazetaec

Untitled

Nov 15th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. select array_to_string(array_agg(u.correo), ',') as correos
  2. from (select tc.nombre as congreso, tcl.nombre_area as tematica, tp.tema ,
  3. case when tpa.id_personal_sga is null
  4. then concat(tpe.nombres,' ', tpe.apellido1, ' ', tpe.apellido2)
  5. else concat(p.nombres,' ', p.apellido1, ' ', p.apellido2)
  6. end as autor,
  7. case when tpa.id_personal_sga is null
  8. then tpe.correo
  9. else p.correo_personal_institucional
  10. end as correo, case when tpa.id_personal_sga is null
  11. then ug2.nombre
  12. else ug.nombre
  13. end as pais,
  14. case when tpa.id_personal_sga is null
  15. then p.telefono_personal_celular
  16. else tpe.telefono_movil
  17. end as celular,
  18. tce.descripcion as estado,
  19. tp.idregistro ,
  20. tcs.sala ,
  21. tca.dia , tca.inicia::time , tca.finaliza::time
  22. from esq_conv_2020.tbl_ponencias tp
  23. join esq_conv_2020.tbl_congreso_linea tcl on tcl.idregistro = tp.id_congreso_linea
  24. join esq_conv_2020.tbl_congreso tc on tc.idregistro = tcl.id_congreso
  25. join esq_conv_2020.tbl_ponencias_autores tpa on tpa.id_ponencia = tp.idregistro
  26. join esq_conv_2020.tbl_convencion_estado tce on tce.idregistro = tp.id_estado
  27. left join esq_conv_2020.tbl_congreso_agendamiento tca on tca.id_ponencia = tp.idregistro
  28. left join esq_conv_2020.tbl_congreso_sala tcs on tcs.idregistro = tca.id_sala
  29. left join esq_datos_personales.personal p on p.idpersonal = tpa.id_personal_sga
  30. left join esq_conv_2020.tbl_personal_ext tpe on tpe.idregistro = tpa.id_personal_tmp
  31. left join esq_catalogos.ubicacion_geografica ug on ug.idubicacion_geografica = p.idtipo_pais_origen
  32. left join esq_catalogos.ubicacion_geografica ug2 on ug2.idubicacion_geografica = tpe.pais_origen::numeric
  33. where tp.id_estado in(53,55,56) ) u
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement