$version = 2010111002;
in lib/db./upgrade.php at around line 5060
// Update question_answers.
// In question_answers.feedback was previously always treated as
// FORMAT_HTML in calculated, multianswer, multichoice, numerical,
// shortanswer and truefalse; and
// FORMAT_MOODLE in essay (despite being edited using the HTML editor)
// So essay feedback needs to be converted to HTML unless $CFG->texteditors == 'textarea'.
// For all question types except multichoice,
// question_answers.answer is FORMAT_PLAIN and does not need to be changed.
// For multichoice, question_answers.answer is FORMAT_MOODLE, and should
// stay that way, at least for now.
$rs = $DB->get_recordset_sql('
SELECT qa.*, q.qtype
q ON a.question = q.id');
The SQL has a syntax error - presumable it should have been 'ON qa.question' but there is certainly no table aliased to just 'a'. This causes an upgrade to 2.0 to fail.