|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 you! |
|
![]() |
| Outils de la discussion | |
|
|