Advertisement
jotazetaec

Untitled

Dec 11th, 2024 (edited)
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. WITH ListadoPonencias AS (
  2. select tc.idregistro as idcongreso, tcl.idregistro as idarea, tcl.nombre_area ,
  3. tp.idregistro ,codigo ,tema , resumen, palabra_clave,
  4. tpa.orden,
  5. tpa.id_tipo_categoria,
  6. CASE
  7. WHEN tpa.id_personal_sga IS NULL THEN concat(tpe.nombres, ' ', tpe.apellido1, ' ', tpe.apellido2)
  8. ELSE concat(p.nombres, ' ', p.apellido1, ' ', p.apellido2)
  9. END AS autor,
  10. tbi.nombre AS filiacion,
  11. CASE
  12. WHEN tpa.id_personal_sga IS NULL THEN tpe.correo
  13. ELSE p.correo_personal_institucional
  14. END AS correo,
  15. ug.nombre AS pais
  16. from esq_conv_2020.tbl_ponencias tp
  17. join esq_conv_2020.tbl_congreso_linea tcl on tcl.idregistro = tp.id_congreso_linea
  18. join esq_conv_2020.tbl_congreso tc on tc.idregistro = tcl.id_congreso
  19. join esq_conv_2020.tbl_ponencias_autores tpa on tpa.id_ponencia = tp.idregistro
  20. LEFT join esq_datos_personales.personal p ON p.idpersonal = tpa.id_personal_sga
  21. LEFT join esq_conv_2020.tbl_personal_ext tpe ON tpe.idregistro = tpa.id_personal_tmp
  22. LEFT join esq_conv_2020.tbl_banco_instituciones tbi ON tbi.idregistro = tpa.id_filiacion
  23. LEFT join esq_catalogos.ubicacion_geografica ug ON ug.idubicacion_geografica = tbi.enum_pais::numeric
  24. where tc.id_convencion = 9
  25. and tp.id_estado in (61,63,64)
  26. and tp.codigo not in('CCIUTM-REG-ADM')
  27. and tc.idregistro not in (128)
  28. order by tc.idregistro,tcl.nombre_area,tc.nombre, tcl.nombre_area , tp.tema,tpa.orden, tpa.idregistro)
  29. select idcongreso, idarea,nombre_area,
  30. u.idregistro ,codigo ,tema , resumen, palabra_clave,
  31. array_to_string(ARRAY_AGG(concat(esq_conv_2020.capitalize_except(u.autor), CASE WHEN u.id_tipo_categoria = 45 THEN '*' END) ORDER BY u.orden ), ', ') AS autores,
  32. array_to_string(ARRAY_AGG(CASE WHEN u.id_tipo_categoria = 45 THEN concat(esq_conv_2020.capitalize_except(filiacion),', ',pais,', ',correo) END), ', ') AS infoautores
  33. FROM
  34. ListadoPonencias u
  35. group by idcongreso, idarea,nombre_area,u.idregistro ,codigo ,tema , resumen, palabra_clave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement