From what I can see PIVOT does an AGGREGATE function - which I don't need.

And of course I have the issue of a "variable" number of columns for each gradebook.