health centre: MDL-16935 Question categories should belong to a valid context solution has SQL that does not work in MySQL

This commit is contained in:
tjhunt
2008-11-27 05:57:04 +00:00
parent 3cacf33b58
commit 4ec232ec6a
+3 -3
View File
@@ -660,10 +660,10 @@ class problem_000015 extends problem_base {
function solution() {
global $CFG;
return '<p>You can delete the empty categories by executing the following SQL:</p><pre>
DELETE FROM ' . $CFG->prefix . 'question_categories qc
DELETE FROM ' . $CFG->prefix . 'question_categories
WHERE
NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'question q WHERE q.category = qc.id)
AND NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'context con WHERE qc.contextid = con.id)
NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'question q WHERE q.category = ' . $CFG->prefix . 'question_categories.id)
AND NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'context con WHERE contextid = con.id)
</pre><p>Any remaining categories that contain questions will require more thought. ' .
'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
}