View previous topic :: View next topic |
Author |
Message |
YVRAMJ Beginner
Joined: 18 Jan 2003 Posts: 12 Topics: 7
|
Posted: Thu May 15, 2003 11:26 am Post subject: SQL question |
|
|
Hi,
I have data in DB2 table like this
CODE NAME NUM
------- ------------------------------ ----
60 TEST PROCESS 315
60 TEST PROCESS 316
60 TEST PROCESS 317
There is an unique index on code & num in this table. There will be multiple records on code and num cobmination. I want distinct code and
all the values in NUM column as a string.
I need a sql to retrieve the data as below
CODE NAME NUMS
----- ------ -------
60 TEST PROCESS 315,316,316
Can any one help me on this ?
Please let me know.
Thanks,
Ram. |
|
Back to top |
|
|
naren_ab Beginner
Joined: 07 Jan 2003 Posts: 32 Topics: 10
|
Posted: Fri May 16, 2003 12:03 pm Post subject: |
|
|
Can you use a program ? |
|
Back to top |
|
|
YVRAMJ Beginner
Joined: 18 Jan 2003 Posts: 12 Topics: 7
|
Posted: Fri May 16, 2003 3:33 pm Post subject: |
|
|
No,
I want to do it all in SQL itself. No host language. |
|
Back to top |
|
|
Glenn Beginner
Joined: 23 Mar 2003 Posts: 56 Topics: 3
|
Posted: Fri May 16, 2003 5:17 pm Post subject: |
|
|
You could do it using SQL but it'd be a total nightmare all the way around. You should really consider doing it through a program. Basically doing what you want involves LOTS of self-joins (enough to fill out the horizontal list). Not a good idea. |
|
Back to top |
|
|
|
|