This question already has an answer here:
My inputs are in this way.
col1 col2
1 a
1 b
2 c
2 d
2 e
O/p: Should Be like
col1 col2
1 a,b
2 c,d,e
I want a query that can be fired at DB level. I've tried various ways, but wasn't able to make this out...
11g and higher: Use listagg:
10g and lower: One method is to use a function:
To use the function:
Note: There is an (unsupported) function
WM_CONCAT
available on certain older versions of Oracle, which might help you out - see here for details.In MySQL: