Concatenate row values [message #427363] |
Thu, 22 October 2009 04:06  |
|
Dear All,
I have one table call operation which has four fields
operation mark_no , pos_no
RE 1001 10
HO 1001 10
RE 1002 20
HO 1003 30
How can i write a query whill concatenate the row values of operation column which has same mark_no and pos_no.
I want output like below
RE-HO 1001 10
RE 1002 20
HO 1003 30
If both Mark_no and Pos_no has two different operations it should come concatenated otherwise as it is.Please help.
|
|
|
|
|
Re: Concatenate row values [message #427499 is a reply to message #427363] |
Thu, 22 October 2009 23:41   |
lakshmis
Messages: 102 Registered: November 2008 Location: India
|
Senior Member |
|
|
SQL> SELECT * FROM test;
OPERATION MARK_NO POS_NO
---------- ---------- ----------
RE 1001 10
HO 1001 10
RE 1002 20
HO 1003 30
SQL> SELECT REPLACE(wm_concat(operation),',','-') operation,mark_no,pos_no FROM test GROUP BY mark_n
o,pos_no;
OPERATION MARK_NO POS_NO
---------- ---------- ----------
RE-HO 1001 10
RE 1002 20
HO 1003 30
Regards,
Lakshmi
|
|
|
|
Re: Concatenate row values [message #427540 is a reply to message #427499] |
Fri, 23 October 2009 03:30  |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
@lakshmis - wmconcat is an undocumented function - Oracle are under no obligation to keep it's functionality the same in future releases.
I'd really recommend against using undocumented features in production code.
|
|
|