mysql 8.0 使用merge语法错误
刚学 sql 不久,看 sql 进阶教程做的练习题,对着答案修改之后,依然不能运行,有大神愿意解答一下吗?
MERGE into Class_A AS A
USING (SELECT * FROM Class_B) AS B
ON (A.id = B.id)
WHEN matched
THEN UPDATE SET A.name = B.name
WHEN NOT matched
THEN INSERT (id, name)
VALUES (B.id, B.name);
workbench 的 response 是
Error Code: 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 ‘MERGE into Class_A AS A USING (SELECT * FROM Class_B) AS B ON (A.id = B.id) WHEN’ at line 1Error Code: 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 ‘MERGE into Class_A AS A USING (SELECT * FROM Class_B) AS B ON (A.id = B.id) WHEN’ at line 1
推荐文章: