0
Insert into hotel('fname', 'lname'...
values
  ('null', 'abc'....
ON DUPLICATE KEY UPDATE 
  fname = 'null',
  lname = 'abc',.....

解决上面的mysql查询。

4

2 回答 2

7

如您所见,您没有用single quotes非数字值括起来,

Insert into child (`CASE`,`LASTNAME`,`FIRSTNAME`,`GENDER`,
                   `DOB`,`SSN`,`RACE`,`STREET`,`STREET2`,`CITY`,
                   `STATE`,`ZIP`,`PHONE`,`WORKPHONE`,`CELLPHONE`,
                   `PARENT NAME`,`GR`,`ADMITDATE`,`DISCHDATE`,
                   `WRK`,`WFIRSTNAME`,`WRKPHONE`)
VALUES ('null', 'Sivanesh', 'Jashawn', 'Male', '2002-03-08', 
        '206-80-2175', 'African American', '1689 Crucible Street', 
        'null', 'Pittsburgh', 'PA', '15210', '(412)458-3788', 
        'null', '(412)377-6079', 'Latel Williams', '2nd', '2010-03-17',
        'null', 'null', 'Addison', '(412)594-2545')
ON DUPLICATE KEY UPDATE 
        LASTNAME = 'Sivanesh',
        FIRSTNAME= 'Jashawn',...
于 2012-10-26T00:11:40.470 回答
2

您需要引用“KEY UPDATE”子句中的值

于 2012-10-26T00:15:19.260 回答