Hello all,
Recently I have upgraded our moodle server to the newest weekly (1.9.3+) (this was convenient because the server was migrated to a new machine). After doing all the tasks, I went to the health center, and encountered this health problem:
Question Categories should belong to a valid context
All qestion categories are linked to a context id, and, the context they are linked to must exist. the following categories belong to a non-existant category
<some details>
Any of these categories that contain no questions can just be deleted from the database. Other categories will require more thought
-------------------------
When i press on "view solution", I get this:
-------------------------
Solution
You can delete the empty categories by executing the following SQL:
DELETE FROM mdl_question_categories qc WHERE NOT EXISTS (SELECT * FROM mdl_question q WHERE q.category = qc.id) AND NOT EXISTS (SELECT * FROM mdl_context con WHERE qc.contextid = con.id)
Any remaining categories that contain questions will require more thought. People in the Quiz forum may be able to help.
-------------------------
Needless to say, I am a total newbe to MySQL, and I copied the statement into the MYSql environment. However, when I run it, i get the error that i have an error in my SQL syntax.
My question now is: is this health problem a serious problem? To me it seems it is not that big a deal, but I want to be sure. And how to run the above command, such that the health problem will disappear?
Any toughts much appreciated!