Columnar format instead of row format
friends my report Current CSV export is in this format Year Month amount 2010 Jan 30 2010 jan 40 2010 feb 10 2010 feb 30 user needs CSV export in below format 2010 jan Feb 70 40 plz suggest me. mani
November 13th, 2010 8:32pm

create table #tmp (year int,month char(3),amount int) insert into #tmp values (2010,'Jan',30) insert into #tmp values (2010,'Jan',40) insert into #tmp values (2010,'Feb',10) insert into #tmp values (2010,'Feb',30) select * from #tmp pivot ( sum(amount) for month in (jan ,feb) ) as pvBest Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2010 4:28am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics