Multiple results in a single record - Oracle

3

I have the following situation: I have a select where it returns me that the patient TEST passed in the clinic ABC, and performed procedure 01 and 02, but in the result of query it returns me thus < strong> bold text :

Patient | Clinica | Procedure |

Testing | ABC | 01 | Test | ABC | 02 |

But I needed the following result:

Patient | Clinica | Procedure |

Testing | ABC | 01 - 02 |

I would like some help.

    
asked by anonymous 31.07.2017 / 18:31

1 answer

4

listagg function resolves

select paciente
     , clinica
     , listagg(procedimento, ' - ') within group (order by procedimento)   procedimento
from tabela
group by paciente, clinica

link

    
01.08.2017 / 14:58