mysql - 使用保留名称作为列名
我正在尝试运行此查询,但未运行
SELECT ng.parent_id, ng.tab, ng.post_id, ng.ORDER, ng.cluster_key, pd.id, pd.slug, pd.link_text, pd.parent
FROM `ecom_navigation` AS ng, `ecom_page_data` AS pd
WHERE ng.cluster_key = 'primary'
AND ng.tab = '0'
AND ng.parent_id = '1'pd.id = ng.post_id
ORDER BY ng.order
并出现错误
您的 SQL 语法有错误;检查手册 与您的 MySQL 服务器版本相对应,以便使用正确的语法 第 1 行的“pd.id = ng.post_id ORDER BY ng.order”附近
我尝试过“ng.order”和“ng”。“order”,但似乎仍然无法让它运行。
非常感谢任何帮助
I am trying to run this query but doesn't run
SELECT ng.parent_id, ng.tab, ng.post_id, ng.ORDER, ng.cluster_key, pd.id, pd.slug, pd.link_text, pd.parent
FROM `ecom_navigation` AS ng, `ecom_page_data` AS pd
WHERE ng.cluster_key = 'primary'
AND ng.tab = '0'
AND ng.parent_id = '1'pd.id = ng.post_id
ORDER BY ng.order
and getting 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 'pd.id = ng.post_id ORDER BY ng.order' at line 1
i've tried `ng.order` and `ng`.`order` but still cant seem to get it to run.
Any help is much appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您只是缺少
and
:可能应该是:
或者更好,将连接条件放在连接中(并且不要引用您的数字,除非它们确实是字符串):
I think you're just missing an
and
:should probably be:
Or better, put the join condition in the join (and don't quote your numbers unless they really are strings):
尝试
ng
.order
如果我可以在这个编辑器中显示反引号,那么它们就会在那里,但似乎删除它们
反引号用于转义保留字和空格在列名称等中
try
ng
.order
if i could get backticks to show in this editor, then they would be there, but it seems to remove them
backticks are used to escape reserved words and spaces in column names etc
将您的查询更改为(您的
'
放错了位置)或
Change your query to (you have a
'
misplaced)OR