DB2 comma separated output -
how inbuilt function comma separated column values in sql in db2 , e.g if there columns policy id , has 3 rows same id have 3 different roles in 3 rows , should retrieve rows in 1 row "3,4,5"
e.g.
1. 4555 "2" 2. 4555 "3" 3. 4555 "4"
output 4555 2,3,4
in db2 in 1 row
this need:
http://radheshk.blogspot.com/2008/02/sql-tips-techniques-string-aggregation.html
sadly, there no way define custom aggregate function in db2 (or not know of). 1 must resort recursive queries, in example above.
another way solve problem involves cursors, worse...
Comments
Post a Comment