SQL错误,我不明白

发布于 2024-09-15 11:54:33 字数 566 浏览 2 评论 0原文

INSERT INTO `tims`.`pending_profile`(`id`, `nickname`, `location`, `role`, `yog`, `interests`, `favMoment`, `gainThisYr`, `futurePlans`, `bio`) 
VALUES ('1', '1', '1', '1', '', '1', '1', '1', '1', '1')
ON DUPLICATE KEY UPDATE ( nickname ='1', location= '1', role= '1',yog= '1',interests= '1',favMoment= '1',gainThisYr= '1',futurePlans= '1',bio= '1')

是什么触发了这个错误?

您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在 '(nickname='1', location='1', role='1',yog='1',interests='1',favMoment 附近使用的正确语法= '1'' 在第 3 行

INSERT INTO `tims`.`pending_profile`(`id`, `nickname`, `location`, `role`, `yog`, `interests`, `favMoment`, `gainThisYr`, `futurePlans`, `bio`) 
VALUES ('1', '1', '1', '1', '', '1', '1', '1', '1', '1')
ON DUPLICATE KEY UPDATE ( nickname ='1', location= '1', role= '1',yog= '1',interests= '1',favMoment= '1',gainThisYr= '1',futurePlans= '1',bio= '1')

What is triggering this error?

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 '( nickname ='1', location= '1', role= '1',yog= '1',interests= '1',favMoment= '1'' at line 3

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

缘字诀 2024-09-22 11:54:33

在字段之间放置逗号:

INSERT INTO tims.pending_profile
  (id, nickname, location, role, yog, interests, favMoment, gainThisYr, futurePlans, bio) 
VALUES
  ('', '1', '1', '1', '', '1', '1', '1', '1', '1')
ON DUPLICATE KEY UPDATE nickname ='1', location= '1', role= '1', yog= '1', interests= '1', favMoment= '1', gainThisYr= '1', futurePlans= '1', bio= '1'

Put comma's between the fields:

INSERT INTO tims.pending_profile
  (id, nickname, location, role, yog, interests, favMoment, gainThisYr, futurePlans, bio) 
VALUES
  ('', '1', '1', '1', '', '1', '1', '1', '1', '1')
ON DUPLICATE KEY UPDATE nickname ='1', location= '1', role= '1', yog= '1', interests= '1', favMoment= '1', gainThisYr= '1', futurePlans= '1', bio= '1'
南城追梦 2024-09-22 11:54:33

您从未打开括号,并且字段之间需要逗号

ON DUPLICATE KEY UPDATE **(**nickname ='1', location= '1', role= '1', yog= '1', interests= '1', favMoment= '1', gainThisYr= '1', futurePlans= '1', bio= '1')     

You never opened your parentheses and you need commas between the fields

ON DUPLICATE KEY UPDATE **(**nickname ='1', location= '1', role= '1', yog= '1', interests= '1', favMoment= '1', gainThisYr= '1', futurePlans= '1', bio= '1')     
蓝色星空 2024-09-22 11:54:33

您是否应该使用逗号分隔要在最后一行更新的列列表?

Should you not use commas to separate your list of columns to update on the last line?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文