如何解决此错误“MySQL错误:1109(MULTI DELETE中的未知表'table_name')”?

我正在使用 PHP 和 MySQL (服务器版本: 5.5.31-0ubuntu0.12.04.2)搭建网站,当我运行下面的查询时,它给了我上面的错误。我找不到这个错误背后的任何线索。有人可以帮助我解决这个错误吗?利用现有的查询? 为了供你参考,我把我的疑问写在下面:

DELETE
   ABC.theory_sheet_set,
   ABC.theory_sheet_questions
FROM
   ABC.theory_sheet_set AS theory_sheet_set,
   OCN.theory_sheet_questions AS theory_sheet_questions
WHERE
   theory_sheet_set.theory_sheet_set_id = theory_sheet_questions.theory_sheet_set_id
   AND theory_sheet_set.theory_sheet_id=".$theory_sheet_id

报错如下:

MySQL Error: 1109 (Unknown table 'theory_sheet_set' in MULTI DELETE)
Session halted.

我的数据库名叫ABC。其上所有的表名都是有效的,涉及到这个查询的所有表都存在于数据库中。你能帮我解决这个问题吗?

If you use the alias names used later into the query at the beginning of of query(i.e. right after the word DELETE) then it will work finely. The only issue there was that it couldn't be able to identify the table from your database as you have used alias names to refer those tables into your database. So in order to remove this bug you must use alias name s you used in the query after DELETE. The rectified query will look like following:

DELETE theory_sheet_set, theory_sheet_questions FROM ABC.theory_sheet_set AS theory_sheet_set, ABC.theory_sheet_questions AS theory_sheet_questions  WHERE theory_sheet_set.theory_sheet_set_id=theory_sheet_questions.theory_sheet_set_id AND  theory_sheet_set.theory_sheet_id="$theory_sheet_id

there are syntax error, try on this

DELETE *
FROM
theory_sheet_set theory_sheet_set
INNER JOIN 
theory_sheet_questions theory_sheet_questions ON  
theory_sheet_set.theory_sheet_set_id = theory_sheet_questions.theory_sheet_set_id
WHERE theory_sheet_set.theory_sheet_id=".$theory_sheet_id