by Hubert Chathi.
Aside from the semicolon that made your query fail, you also should not be hard-coding the "mdl_" table prefix; you should wrap your table names in braces. So, instead of, for example, "mdl_role_assignments", write "{role_assignments}".