Pivoting columns in SQL Server -
i have below result set(ignore column names, modified show in form of columns) generated using query given
source rfrshcycleid sorcetype cyclenmber cyclenme sltme rfrshcycledetalid publishtime ------------------------------------------------------------------------- mercury 1 summary 1 cycle1 3:00:00 null null mercury 2 summary 3 cycle3 6:00:00 1 4/21/15 4:32 mercury 3 summary 5 cycle5 10:00:00 null null mercury 4 summary 2 cycle2 15:00:00 null null mercury 5 detail 1 cycle1 8:00:00 null null mercury 6 detail 2 cycle2 23:00:00 null null mercury 7 complete 1 cycle1 3:00:00 2 4/18/15 1:42 mercury 8 complete 3 cycle3 6:00:00 null null mercury 9 complete 2 cycle2 15:00:00 null null mercury 10 complete 4 cycle4 18:00:00 null null
the query used above resultset :
select rc.source source, rc.refreshcycleid refreshcycleid, rc.sourcetype sourcetype, rc.cyclenumber cyclenumber, rc.cyclename cyclename, rc.slatime slatime, rcd.refreshcycledetailid refreshcycledetailid, rcd.publishtime publishtime refreshcycles rc full outer join refreshcycledetails rcd on rc.refreshcycleid = rcd.refreshcycleid rc.source = 'mercury'
i want result set following
i tried unpivoting , pivoting resultset, being new pivot/unpivot, not correct result. kindly help.
you can't sql server, , reason. classic example of distinction between data storage , data presentation. initial reaction keep data in normalised form correct. should investigate creating linked server excel document create matrix report, or of course there ssrs, bit more involved , requires more work set up.