简体   繁体   中英

Three Table UPDATE and JOIN result in Error 1064

I am trying to execute the following code:

UPDATE 
    CustomerShowing
SET 
    CustomerShowing.rate = 5
FROM 
    CustomerShowing
INNER JOIN 
    Showing
ON 
    CustomerShowing.showid = Showing.showid
INNER JOIN 
    Movie
ON 
    Showing.movieid = Movie.movieid
WHERE 
    Movie.name='Batman';

however I am receiving the following error:

ERROR 1064 (42000) at line 86: 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 'FROM CustomerShowing INNER JOIN Showing ON CustomerShowing.ShowingID = Showing' at line 3

How could I fix this? I am using MySQL version 5.5.53 .

MySQL uses a different syntax than SQL-Server.

 UPDATE CustomerShowing
 INNER JOIN Showing ON CustomerShowing.showid = Showing.showid
 INNER JOIN Movie ON Showing.movieid = Movie.movieid
 SET CustomerShowing.rate = 5
 WHERE Movie.name='Batman';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM