2016-10-10 120 views
-1

我不知道問題是什麼。有什麼想法嗎? 我試圖從grading表更新我的first_q列。帶INNER JOIN的MySQL更新語句

UPDATE gradings g set g.first_q = 90 FROM gradings 
INNER JOIN subjects ss 
on ss.subject_id = g.subject_id 
INNER JOIN students s 
ON s.id = g.student_id 
INNER JOIN school_years sy 
on sy.id = g.sy_id 
INNER JOIN teachers t 
on t.id = g.teacher_id 
WHERE s.id = 1; 
+0

你得到任何錯誤或你有什麼問題? – Jens

+0

你可以投我的答案嗎? –

回答

0

的語法是錯誤的把JOIN秒。也許你應該嘗試這樣的事:

UPDATE分級摹 INNER上ss.subject_id = g.subject_id JOIN科目SS INNER JOIN學生小號 ON s.id = g.student_id INNER JOIN school_years SY on sy.id = g.sy_id INNER JOIN teachers t on t.id = g.teacher_id set g.first_q = 90 WHERE s.id = 1;

MYSQL Update Statement Inner Join Tables

+0

謝謝!我的語法錯了。 – mrgx

0

我相信你可以只取出FROM gradings和前SET