How can I "merge", "flatten" or "pivot" results from a query which returns multiple rows into a sing
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:53 UTC
Read the original article
Hit count: 233
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