Re: multi-column key with "ON DUPLICATE KEY UPDATE"
On Thu, 20 Dec 2007 15:23:12 +0100, <jezaustin@gmail.com> wrote:
> Hi guys,
> Been trying to use ON DUPLICATE KEY UPDATE on a MyISAM table with a
> multi-column primary key, and I keep getting a syntax error message.
> eg
>
> INSERT INTO contacts_extra (contact_id, keyword, value)
> VALUES (1, '10/Primary food activity', '2')
> ON DUPLICATE KEY UPDATE `value`='2';
>
> on a table like
> CREATE TABLE `contacts_extra` (
> `contact_id` INT UNSIGNED NOT NULL
> ,`keyword` VARCHAR(63) NOT NULL
> ,`value` VARCHAR(255) NOT NULL
> ,PRIMARY KEY (`contact_id`, `keyword`)
> ) TYPE=MyISAM;
>
> Is there something special about multi-column keys that prevents on
> duplicate key update from working? Or have I really made a silly
> syntax error?
...works perfectly here? Are you sure that is the exact query you enter,
and if so, what is the actual error you're getting?
--
Rik Wasmus
|