I am soo close! I have a survey and the client wants to be able to see reports using various weights for the answers. SQLFiddle only allows 2008 and up but in 2005 I am getting these results:
Lesson wt count -> | w1_5 | w2 | w3 | w5_5 | w6_5 | N
-----------------------------------------------------
q2 | 1.5 | 2 | 3 | 5.5 | 6.5 | 9
Obviously they should be counts and not weights.
Furthermore the only record being returned happens to be a row that has 0 nulls.
I have made an SQLFiddle with a non-dynamic example of my expected outcome at the bottom.
I am not sure what the difference is that is making my dynamic query not sum and the non-dynamic one does.
Here is my previous work (1,2,3)
---UPDATE---FINAL SOLUTION---
Posted here For those who are interested.