I get the following error listed below and was wondering how do I fix this problem.
Not unique table/alias: \'grades\'
Here is the code I think
You need to use an alias if you're using the same name twice:
SELECT FROM grades g1 ... JOIN grades g2 ON g1.id = g2.grade_id ...
Be sure that you intended to use the same name twice, and didn't mistakenly enter the same name twice.