kregen
New User
Joined: 16 Mar 2006 Posts: 21
|
|
|
|
Hello,
i'm searching for a way to concat multi rows from 1 table.
Table
--------
1 a
1 b
1 c
1 d
2 a
3 a
3 b
4 x
5 z
6 1
6 2
i need a result like:
1, a, b, c, d
2, a
3, a, b
4 x
5 z
6 1, 2
is there a way in DB2 V7.2 OS/390 to get the resultset?
cu
kai |
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It would be rather easy if you use a cursor. . . .
With a cursor and an ordered by, you could get your result in one pass of the data.
Someone may post a complex query, but it may well be far more expensive to run. |
|