Hi. We run 2012 enterprise and the following pivot is returning 7 rows per dept instead of 1 ...
select dept,[Mon],[Tue],[Wed],[Thu],[Fri],[Sat],[Sun] from #resultset pivot ( sum(calc) for [datename] in ([Mon],[Tue],[Wed],[Thu],[Fri],[Sat],[Sun]) ) as pvt order by dept
can someone help? There are a couple of null values for [calc] in my table but my understanding is that shouldnt matter. Instead of one row with 0.0,0.25,null,1.0,1.0,1.0,1.0 for dept A in cols Mon thru Fri, I'm getting this...
Dept Mon Tue Wed Thu Fri Sat Sun
A 0.0 null null null null null null
A null 0.25 null null...
A null null null null...
A null null null 1.0....etc