私は2つのテーブルを持っています。質問と他は答えはです。内部結合を持つ2つのテーブルを更新する
Questionテーブルは今、私は答えはどこdoctor_id質問に属して更新したい
answer_id, question_id, comment, rating, doctor_id
などのフィールドを持っている
question_id, question, type, answer_id.
回答テーブルようにフィールドを持っています。
update question q
set q.question = 'dmvvnnv',a.comment = 'covonfvk',a.rating = 5
INNER JOIN answer a on q.answer_id = a.answer_id
WHERE a.doctor_id = 8
しかし、それは私に構文エラーを与えている:このために私は、このクエリを記述しようとした
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN answer a on q.answer_id = a.answer_id WHERE a.doctor_id = 8' at line 1
の可能性のある重複した[MySQLの使用:内部結合使用して値を持つUpdateフィールド](http://stackoverflow.com/questions/14006856/using-mysql-update -field-with-values-with-inner-join) – jpw
また、https://stackoverflow.com/questions/8057565/mysql-update-statement-inner-join-tables?noredirect=1&lq=1これはより良いデュープターゲット。 – jpw