I have a table called "Example"
CREATE TABLE IF NOT EXISTS `example` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I want to insert values if not exists and if the value exists then update, so I am using following statement:
INSERT INTO example (a, b, c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE a = VALUES(a), b = VALUES(b), c = VALUES(c);
After the above queries executed the table look like this:
Again I execute the above statement, the result looks like this:
What is wrong with my statement?