我有这个SQL查询:
insert into messages
(message, hash, date_add)
values
('message', 'hash', NOW())
ON DUPLICATE KEY IGNORE
哈希是唯一的,查询有什么问题?我收到了错误:
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 'IGNORE' at line 1
答案 0 :(得分:4)
根据MySQL doc,语法应为:
INSERT IGNORE INTO messages (message, hash, date_add)
VALUES('message', 'hash', NOW());