0
I need to bring these results, in a single line, where it is only separated by a comma,
how do I do that?
Query:
SELECT ' '|| (SELECT DECODE(MAX(g.ds_opcao),NULL,'',MAX(g.ds_opcao)||' - ') FROM nut_opcao g WHERE g.nr_sequencia = c.nr_seq_opcao_sel) ||
SUBSTR(e.ds_receita,1,255)ds_cardapio
FROM nut_pac_opcao_rec c,
nut_atend_serv_dia d,
nut_receita e
WHERE c.NR_SEQ_SERVICO_DIA = d.nr_sequencia
and c.nr_seq_receita = e.nr_sequencia
and nvl(e.ie_situacao, 'A') = 'A'
AND NVL(ie_receita_especial,'N') = 'N'
AND d.dt_servico BETWEEN TO_DATE(:DT_SERVICO) AND TO_DATE(:DT_SERVICO) + 86399/86400
AND d.nr_seq_servico = :nr_servico_p
AND d.nr_atendimento = :nr_atendimento_p
ORDER BY ds_cardapio[![inserir a descrição da imagem aqui][1]][1]
this is called "pivot", look for pivot here on the site or google for "pivot oracle"
– Ricardo Pontual
Search by LISTAGG https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions089.htm#SQLRF30030
– Motta
i got with listagg, mt thanks
– Bruno Oliveira Santos