MYSQL插入重复

时间:2012-04-20 10:41:09

标签: mysql

我正在尝试运行以下声明:

INSERT INTO table (
    as,
    ad
    ,af,
    ag,
    ah,
    aj
)                                       
VALUES (
    'a',
    'b',
    'c',
    'd',
    'e',
    'f'
)
ON DUPLICATE KEY UPDATE (
    aj='dv',
    ah='ev',
    ag='fv'
);

并收到以下错误:

You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version for the 
right syntax to use near '(ag='dv',ah='ev',ah='fv')' 
at line 3

有什么建议吗?

THX

1 个答案:

答案 0 :(得分:5)

略过()..

 INSERT INTO site_domains_meta 
 (domainname,metatype,pagename,english,indonesian,japanese)
  VALUES ('a','b','c','d','e','f')
  ON DUPLICATE KEY UPDATE english='dv',indonesian='ev',japanese='fv';

http://dev.mysql.com/doc/refman/5.5/en/insert.html