我很难理解带有重复密钥更新检查的插入的正确语法。
我目前收到查询错误:
INSERT INTO users_items (q,id,uid)
ON DUPLICATE KEY UPDATE
q = q + ?, id = ?, uid = ?
唯一键是uid
+ id
。
我的错误是:
Syntax error or access violation: 1064 You have an error in your SQL syntax;
答案 0 :(得分:1)
VALUES
是必填部分(或SET
或SELECT
)
INSERT INTO users_items (q,id,uid)
VALUES (v1, v2, v3) -- <<< this is what you missed
ON DUPLICATE KEY UPDATE
q = q + ?, id = ?, uid = ?
Referene: