MySQL Forums
Forum List  »  Newbie

Re: INSERT... ON DUPLICATE KEY UPDATE
Posted by: Barry Galbraith
Date: April 19, 2015 05:02PM

ON DUPLICATE KEY UPDATE means that if, in doing an INSERT, you would get a UNIQUE KEY collision, then UPDATE this (these) field(s) of the existing row to this (these) values.

With your statement, you seem to be saying that if a row with 'Jordan Speith' already exists, then update these columns tournament='RBC Heritage', year='2015', name='Jordan Spieth', thru='56', total='-12'.

Any columns you don't want to be updated don't have to be specified. IOW, you won't need to specify the name filed and it's value. It's obviously already there!

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: INSERT... ON DUPLICATE KEY UPDATE
April 19, 2015 05:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.