Thanks for your reply AceMan!
Following is the basic query structure:
SELECT Code, Year, Gender AS Group, Avg(Score) AS Mean
FROM Table1
GROUP BY Code, Year, Gender
UNION ALL
SELECT Code, Year, Ethnicity, Avg(Score)
FROM Table1
GROUP BY Code, Year, Ethnicity
UNION ALL
SELECT Code, Year...