0

I have the next table:

NUMBER | ELEMENT
-------+----------
1      | Elemento1
1      | Elemento2
1      | Elemento3
2      | Elemento5
2      | Elemento6
2      | Elemento7

I am searching an group by select that returns me the next:

1 | Elemento1Elemento2Elemento3
2 | Elemento5Elemento6Elemento7

I tried with:

Select number, element from table group by number;

But it returns me not a group by expresion

Anyone knows how can I achieve this, if it is possible?

Thanks for your time

Transy
  • 59
  • 1
  • 1
  • 10

1 Answers1

2

Use listagg :

Select number_, listagg(element) within group (order by element) as elements
From your_table
Group by number_

Cheer!!

Popeye
  • 35,427
  • 4
  • 10
  • 31