Use of STRING_AGG in Postgresql

Asked

Viewed 16 times

0

Good afternoon friends,

I used the script below:

SELECT id_docent
, STRING_AGG(distinct no_municipio, ' / ') AS "Municipios" FROM public tb_uf INNER JOIN public.ts_docent ON (tb_uf.co_uf = ts_docente.co_uf) AND (tb_uf.co_municipio = ts_docente.co_municipio)
GROUP BY id_docente

That gave me the result:

inserir a descrição da imagem aqui

I would like to know if there is a command that tells me which dependency on municipalities, so:

inserir a descrição da imagem aqui

Thanks for your attention.

  • Explain where the "depedência would come from".

  • Dependency is whether it belongs to the State Network or Municipal or Federal or Private; and the command is in ts_docente

  • A column ? Tried to concretely "no_municipio" ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.