0
I have a dataset built for use as a parameter. However, several codes refer to the same description, and I cannot make the descriptions not repeat when placing the description as a search parameter. Follow the query:
with apg_cd_situacao (apg_cd_situacao, apg_cd_situacao_descricao) as (values
('AA','Análise'),
('DN','Análise'),
('DR','Análise'),
('DP','Análise'),
('AN','Análise'),
('AL','Análise'),
('DU','Análise')
)
select apg_cd_situacao, apg_cd_situacao_descricao
from apg_cd_situacao
;
I have tried to join the codes (('AA','DN', 'DR',...), 'Analysis'), but it is not working
Try to make a GROUP BY apg_cd_situacao_descricao and in the select list use some appropriate aggregation function, according to your DBMS, for example. array_agg(apg_cd_situacao) or string_agg(apg_cd_situacao).
– anonimo