SQL Error on: SELECT subjectarea.* FROM subjectarea,agreement,course WHERE subjectarea.id=agreement.subjectarea_id AND course.id=agreement.fromcourse_id AND course.level_id= AND agreement.published IS NOT NULL GROUP BY subjectarea.id ORDER BY name

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND agreement.published IS NOT NULL GROUP BY subjectarea.id ORDER BY name' at line 2