I am new to SQL and trying to write a query against the following results table that would allow me to list the subjects where the student Mary has got a higher score than Tom.
Subject Student Teacher Score
--------------------------------------------------
Maths Tom Anderson 67
Maths Mary Anderson 68
English Tom Lewis 55
English Mary Lewis 44
French Tom Joubert 87
French Mary Joubert 76
Geography Tom Arnold 76
Geography Mary Arnold 82
The result should be a table as follows:
Subject
---------
Maths
Geography
I believe I should be using the join clause but am unable to get this to work.
Thanks