简体   繁体   English

下面的mysql代码怎么了

[英]Whats wrong with the following mysql code

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

Solve the above mysql query. 解决上面的mysql查询。

as you can see, you didn't enclose with single quotes the values which are not numeric, 如您所见,您没有使用single quotes将非数字值括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',...

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM