I have a table:
quiz userid attempt grade 1 3 1 33 2 3 1 67 1 3 2 90 10 3 4 20 2 3
SELECT AVG(grade), attempt FROM table GROUP BY attempt ORDER BY attempt DESC LIMIT 2