kusanagi
kusanagi

Reputation: 14614

MySQL insert record

I have this SQL query:

insert into messages 
(message, hash, date_add) 
values
('message', 'hash', NOW()) 
ON DUPLICATE KEY IGNORE

hash is unique, what is wrong with query? i got the error:

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

Upvotes: 0

Views: 139

Answers (1)

Maxime Pacary
Maxime Pacary

Reputation: 23061

According to MySQL doc the syntax should be :

INSERT IGNORE INTO messages (message, hash, date_add)
  VALUES('message', 'hash', NOW());

Upvotes: 4

Related Questions