'on duplicate key update' and 'last_insert_id'

2006-06-30 Thread Rob Desbois
I have a table `event` with two keys: `id` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT, `location_id` MEDIUMINT(8) UNSIGNED NOT NULL, `timestamp` DATETIME NOT NULL, `type` ENUM('0','1','2','3','4','5','6','7','8','9') NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY (`location_id`,`timestamp`,`type`)

Re: 'on duplicate key update' and 'last_insert_id'

2006-06-30 Thread David Hillman
On Jun 30, 2006, at 10:44 AM, Rob Desbois wrote: That leaves me with ON DUPLICATE KEY UPDATE. It's not amazingly helpful as you have to provide a column to update - however I can just say e.g. ON DUPLICATE KEY UPDATE id=id The problem with this is that if I then do SELECT LAST_INSERT_ID