I have a query which successfully returns the top three test results for a student as follows.
TestID | PersonID | Subject | Score
-----------------------------------
1 1 Maths 92
2 1 Science 88
3 1 English 82
I want to nest my current query to show the data as follows?
PersonID | BestSubject | 2ndBestSubject | 3rdBestSubject
---------------------------------------------------------
1 | Maths | Science | English
I could nest my current query three times, but it seems inefficient given the information is there after running it once.
Is there a more efficient way to do this?