I have the following query which works fine:
UPDATE IGNORE table SET a = "a", b = "b" WHERE c = "c" AND d = "d"
The point of this is pretty clear - to update all the rows in the table where c="c" and d="d" with new values of a and b. I am trying to rewrite this query using an INSERT...ON DUPLICATE KEY UPDATE statement. What I have so far is:
INSERT INTO table (a, b, c, d) VALUES ("a", "b", "c", "d") ON DUPLICATE KEY UPDATE a=VALUES(a), b=VALUES(b);
However all this does is make a new row with those values.
Both a and b are unique indexes, or at least when I run show index their "non-unique" field is 0.
I'm pretty new to MySQL so I'm not really sure what I'm doing wrong here.