This is a discussion on multi-column key with "ON DUPLICATE KEY UPDATE" within the MySQL Database forums, part of the Database Forums category; Hi guys, Been trying to use ON DUPLICATE KEY UPDATE on a MyISAM table with a multi-column primary key, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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? Thanks, J. |
|
|||
|
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 |
|
|||
|
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; > This is not the promised example of the syntax error message. If you post the EXACT error message that you are getting, maybe we can help you! |