tags:

views:

85

answers:

1

I am using Oracle 10.2.0 and I am new with it. I need a sql Statement

I have a table with 3 columns. in the column1 are numbers and same of them have equals values in column2 and cloumn3 are String. How can I get the Strings from column2 and column3 together separated with ";" when Numbers from column1 are equals.

thanks

+2  A: 

Ïf you have access to the analytical functions:

SELECT column1, LISTAGG(column2, ',') WITHIN GROUP (ORDER BY column2) AS ConcatedValues
FROM   table
GROUP BY column1;
vc 74
To illustrate Colin's comment, if you consider this answer was helpful, you can click on the up arrow at the left of my message, if this is the answer you were looking for, you can click the checkmark. (Note: I'm not saying you should do it, I'm just telling you how to...)
vc 74
I give it a try and I have this error from the DB 00923. 00000 - "FROM keyword not found where expected"
Haythem
I think the function was introduced in 11g R2, which version are you using?
vc 74
Try this if you don't have 11g R2 -----> SELECT column1, wm_concat(column2) AS ConcatedValue FROM table GROUP BY column1;
vc 74