Sometimes you just don’t want to do anything if a key already exists in the DB.
mysql> INSERT INTO `table` SET id=5, name=`arthur` ON DUPLICATE KEY UPDATE 0+0;
Source
Tags: MySQL
This entry was posted on Monday, October 27th, 2008 at 4:27 pm and is filed under MySQL. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Thanks, was looking for this.
Or use: INSERT IGNORE INTO `table` SET id=5, name=`arthur`
Name (required)
Mail (will not be published) (required)
Website
© 2007-2013 Bottomless, Inc. All Rights Reserved
Switch to our mobile site
Thanks, was looking for this.
Or use:
INSERT IGNORE INTO `table` SET id=5, name=`arthur`