Permalink
Browse files

MDL-29520 - mysql multitable delete, outer join some tables

  • Loading branch information...
1 parent b15cd07 commit 94d5bb3b505b5ee428188c6caa2523c86296b266 @stronk7 stronk7 committed Oct 9, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 question/engine/datalib.php
@@ -695,8 +695,8 @@ protected function delete_usage_records_for_mysql(qubaid_condition $qubaids) {
DELETE qu, qa, qas, qasd
FROM {question_usages} qu
JOIN {question_attempts} qa ON qa.questionusageid = qu.id
- JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
- JOIN {question_attempt_step_data} qasd ON qasd.attemptstepid = qas.id
+ LEFT JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
+ LEFT JOIN {question_attempt_step_data} qasd ON qasd.attemptstepid = qas.id
WHERE qu.id ' . $qubaids->usage_id_in(),
$qubaids->usage_id_in_params());
}
@@ -713,7 +713,7 @@ protected function delete_attempt_steps_for_mysql($test, $params) {
$this->db->execute('
DELETE qas, qasd
FROM {question_attempt_steps} qas
- JOIN {question_attempt_step_data} qasd ON qasd.attemptstepid = qas.id
+ LEFT JOIN {question_attempt_step_data} qasd ON qasd.attemptstepid = qas.id
WHERE qas.questionattemptid ' . $test, $params);
}

0 comments on commit 94d5bb3

Please sign in to comment.