Hi Kamal,
Please execute the following query by changing the Table and
Column names as per your requirement. Hope it will solve your purpose.
WITH TEMP1 (NUM#, SNO_T, NAME_T) AS
(SELECT SMALLINT(1), SNO, RTRIM(VARCHAR(NAME, 50))
FROM EMP
UNION ALL
SELECT SMALLINT(T.NUM#+1), E.SNO, RTRIM(E.NAME)||','||RTRIM(T.NAME_T)
FROM EMP E, TEMP1 T
WHERE E.SNO <> T.SNO_T
AND E.NAME < T.NAME_T
)
SELECT NAME_T
FROM TEMP1 T
WHERE NUM# = (SELECT MAX(NUM#) FROM TEMP1);
regards,
Ravinder.
-----Original Message-----
From: [Email address protected]
[mailto:db2udbdba-ezmlmshield-x16478094.[Email address protected]
Sent: Saturday, July 29, 2006 2:33 PM
To: LazyDBA Discussion
Subject: Query
Hi ALL,
I'm
Thanks and Regards,
Kamal K Nelli,
Ph: 9911077055(Mob).
Hi ALL,
I'm having a table with the following values:
No NAME
1 A
2 B
3 C
When we execute a query I would like the result to be like:
ie., In the o/p all the rows in the NAME column should be separated by a
comma.
o/p: A,B,C
Thanks in Advance
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
“The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus/trojan/worms/malicious code transmitted by this email.
www.mind-infotech.com “
DB2 & UDB email list listserv db2-l LazyDBA home page