I'll say the same thing I always say: Do pivoting in the front end, not in the database. Easier, more efficient, gives the end user more options.
However, if you have to do it in the database for some reason, do you mean the results to be the way you presented them? It looks to me like the 20 should be in the last column and there should only be one row. Is that correct?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon