I have the following table:
date | name | grade
-------------------------
2016-10-01| Alan | 6
2016-10-03| Josh | 8
2016-10-06| Alan | 4
2016-10-05| Alan | 5
2016-10-14| Rosie | 7
I need a query that returns a table that looks like this:
name | grade1 | grade2 | grade3
----------------------------------
Alan | 6 | 4 | 5
Josh | 8 | NULL | NULL
Rosie | 7 | NULL | NULL
So it basically if it finds a name twice or more times, it adds a column and puts the grade there. Is such a thing even possible?
Also, the grades can be up to one trillion, so the solution linked here does not work. However it's almost impossible for a "name" to have more than 2 or 3 grades.