the pivot on aggregation function works on numbers, what I want is a pivot on literal/character. for example, instead of having sum(amount) to be pivoted, I'd like to see a varchar column to be concatenated.
create table d(tablename varchar(9), columnmane varchar(9))
insert into d values ('tableA','col1')
insert into d values ('tableA','col2')
insert into d values ('tableB','col1')
insert into d values ('tableB','col2')
I want to see a result like
tablename , columnlist
tablea col1, col2
tableb col1, col2
I can only use cursor to program it for now, but like to see a solution with a single pivot sql statement if anyone know how to do it.
Senior DBA; Oracle/MSSQL/Sybase; CTV television inc.