mysql无法使用select和subselect指定目标表并选择

时间:2013-05-02 03:32:22

标签: mysql sql-update

我有这个问题:

UPDATE answers AS aa SET aa.question_id=(SELECT q.id FROM question AS q WHERE q.question LIKE (SELECT a.question_prev FROM answers AS a))

错误:

  

mysql无法指定目标表

无法弄清楚如何编辑它才能正常工作

1 个答案:

答案 0 :(得分:1)

试试这个,

UPDATE  answers a
        INNER JOIN question b
            ON b.question = a.question_prev
SET     a.question_id = b.id

请在执行语句前先备份。