I have the below table
ID-----Name------Value
1 City New York
1 Country USA
2 City Barcelona
2 Country Spain
Desired query output is
ID------City-------Country
1 New York USA
2 Barcelona Spain
Could you please let me know if this can be achieved using a query in Oracle. I came across two concepts listagg and pivote but not able to understand how to use those to achieve what I need.
I am getting the result in one way using listagg with the below query but all columns are coming in single column which I need to separate out.
select ID,
listagg(Name||';'||Value, ',') within group (order by Name) as Criteria
from table_name
group by ID;