I have two columns in oracle database
+---------+---------+
| Column1 | Column2 |
+---------+---------+
| A | 1 |
| A | 2 |
+--------
All abow answers are correct and I want to add one case to solve small problem. In my case my_column1
type was nvarchar2
but text was number
and the bellow code does not work and display me only whitespace:
select group_id, listagg( t.my_column1 || '-' || to_char(t.doc_date,'dd.mm.yyyy') || ' ') within group(order by doc_date)
from my_table t
group by group_id
when I wrote like this it works.
select group_id, listagg( to_char(t.my_column1) || '-' || to_char(t.doc_date,'dd.mm.yyyy') || ' ') within group(order by doc_date)
from my_table t
group by group_id
I hope my feedback would save someone's time