dongpi9164 2013-08-21 06:28 采纳率: 0%
浏览 2909

如何解决此错误“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。其上所有的表名都是有效的,涉及到这个查询的所有表都存在于数据库中。你能帮我解决这个问题吗?

  • 写回答

2条回答 默认 最新

  • doupaoshu8334 2013-08-21 06:53
    关注

    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
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题