Mysql超奇怪的语法错误?

发布于 2024-11-03 22:20:51 字数 339 浏览 7 评论 0原文

INSERT INTO pmessage (content, time, sent_by, to) VALUES ('k', '0000-00-00 00:00:00', 84, 1);

您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行 'to) VALUES('tt', '2011-04-28 14:04:45', 84, 1)' 附近使用的正确语法

问题是我看不出我的语法有什么问题。列名等没有问题,我们试了很多次。我们从互联网上复制/粘贴了精确的插入命令几次,但仍然遇到相同的错误。

有人有什么想法吗?服务器是MySQL 5服务器

INSERT INTO pmessage (content, time, sent_by, to) VALUES ('k', '0000-00-00 00:00:00', 84, 1);

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 'to) VALUES('tt', '2011-04-28 14:04:45', 84, 1)' at line 1

The problem is i cannot see anything wrong with my syntax. There is nothing wrong with the column names etc, we tried many times. We copy/pasted the exact insert command from internet a few times than edited and still we got same error.

Anyone have any idea? The server is a MySQL 5 server

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

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

发布评论

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

评论(5

后知后觉 2024-11-10 22:20:51

TO 是保留字。请参阅此处: http://dev.mysql.com/doc/ refman/5.0/en/reserved-words.html

试试这个:

INSERT INTO pmessage (content, time, sent_by, `to`)
VALUES ('k', '0000-00-00 00:00:00', 84, 1);

TO is a reserved word. See here: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html.

Try this instead:

INSERT INTO pmessage (content, time, sent_by, `to`)
VALUES ('k', '0000-00-00 00:00:00', 84, 1);
沫离伤花 2024-11-10 22:20:51

to 是 MySQL 关键字。你不能就这样免费使用它。尝试[到]

to is a MySQL keyword. You cannot just use it free like that. Try [to]

风情万种。 2024-11-10 22:20:51

你的问题是 toMySQL保留字,因此您需要引用它。

You problem is that to is a MySQL reserved word, so you'll need to quote it.

嘿看小鸭子会跑 2024-11-10 22:20:51

将“to”用反引号括起来

INSERT INTO pmessage (content, time, sent_by, `to`) VALUES ('k', '0000-00-00 00:00:00', 84, 1);

Wrap "to" in backticks

INSERT INTO pmessage (content, time, sent_by, `to`) VALUES ('k', '0000-00-00 00:00:00', 84, 1);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文