I need to display he data in the following format 2001200220032004....sumdata11020101050data22020202080data330202030100sum60605060 My sql query is select year, data1, data2,data3 from table1. Year data1,data2,data3 are allseparate columns in the table. Cross tab does not help in this case