mysql - Updating two tables with an inner join -


i have 2 tables 1 question , other answer.

question table has fields

question_id, question, type, answer_id.  

answer table has fields

answer_id, question_id, comment, rating, doctor_id 

now want update answer belongs question doctor_id. tried write query :

update question q  set q.question = 'dmvvnnv',a.comment = 'covonfvk',a.rating = 5  inner join answer on q.answer_id = a.answer_id  a.doctor_id = 8 

but giving me syntax error :

1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'inner join answer on q.answer_id = a.answer_id a.doctor_id = 8' @ line 1

for mysql update join syntax different, set part should come after join

use following query update entries:

update question q inner join answer on a.answer_id = q.answer_id set q.question = 'dmvvnnv'     ,a.comment = 'covonfvk'     ,a.rating = 5 a.doctor_id = 8 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -