Reputation: 821
INSERT INTO TABLE(APIKEY, CLIENTID, rID) VALUES('33333meow', '2', '3')
ON DUPLICATE KEY UPDATE APIKEY='meo11111111w';
The above code will insert but if run a second time, the APIKEY field does not update it just inserts another row.
I've looked at documentation and it looks correct. What else am I doing wrong?
Upvotes: 1
Views: 335
Reputation: 71901
Create a unique key on your table. Probably the columns clientid
and rid
. That will trigger the duplicate key trigger
Upvotes: 2