I have a table with a primary key with two columns (key1,key2).
This is my request.
INSERT INTO mytable (key1, key2, val1, val2)
VALUES (:k1, :k2, :v1, :v2)
ON DUPLICATE KEY UPDATE val1 = val1 + :v1, val2 = val2 + :v2
Now, when I insert a row with a duplicate key, I get this error message:
Disable a PDOException with the message "SQLSTATE [23000]: Integrity constraint violation: 1062 Duplicate entry '157-433' for key 'PRIMARY' in ...
Why doesn't he just update the existing (157,433) -row?
eevaa source
share