This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- using db2 newer versions | |
create table t1 (num int, color varchar(10)); | |
insert into t1 values (1,'red'), (1,'black'), (2,'red'), (2,'yellow'), (2,'green'); | |
select num, | |
substr( xmlserialize( xmlagg( xmltext( concat( ', ', color ) ) ) as varchar( 1024 ) ccsid 37 ), 3 ) | |
from t1 | |
group by num; |