我有一张与另一张桌子有关的桌子。我需要插入ID并更新重复键插入。下面是我插入表中的查询,但给出了语法错误。将插入多行 (88,90709),(88,90710),..
Error Number: 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 '90713), business_id= VALUES(88)' at line 3
INSERT INTO business_service_coverage (business_id, area_id) VALUES (88,90713) ON DUPLICATE KEY UPDATE area_id = VALUES(90713), business_id= VALUES(88)
表格结构
1) id primary key auto increment
2) busienss_id not unique
3) area_id int
答案 0 :(得分:0)
您的syntax指定错误,请尝试以下
INSERT INTO business_service_coverage (business_id, area_id) VALUES (88,90713)
ON DUPLICATE KEY UPDATE area_id = 90713, business_id= 88;