2016-11-12 36 views
0

我想執行以下代碼:三表更新,並加入導致錯誤1064

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'; 

但是我收到以下錯誤:

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

我怎麼能解決這個問題?我正在使用MySQL版本5.5.53

+0

您不斷標記SQL-Server,但您的錯誤消息來自MySQL引擎。並且沒有SQL Server版本5.5.53 –

+2

您使用MySQL。相信我。當然,MySQL安裝在服務器上。但是「SQL-Server」是微軟的產品,而不是MySQL –

回答

2

MySQL使用與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';