How can I "merge" or "flatten" results from a query which returns multiple rows into a single result
Posted
by dsm
on Stack Overflow
See other posts from Stack Overflow
or by dsm
Published on 2010-05-31T11:24:17Z
Indexed on
2010/05/31
11:32 UTC
Read the original article
Hit count: 199
I have a simple query over a table, which returns results like the following:
id id_type id_ref
2702 5 31
2702 16 14
2702 17 3
2702 40 1
2702 26 4
And I would like to merge the results into a single row, for instance:
id concatenation
2702 5,16,17,40,26:31,14,3,1,4
Is there any way to do this within a trigger?
NB: I know I can use a cursor, but I would really prefer not to unless there is no better way.
© Stack Overflow or respective owner