简体   繁体   English

我的SQL语法错误1064-找不到错误

[英]My sql syntax error 1064 -can't find what is wrong

I go this error message when I run this query 运行此查询时出现此错误消息

SELECT name,state FROM customers WHERE state ‌IN ('CA','NC','NY')

Error SQL query: Documentation 错误SQL查询:文档

SELECT name, state
FROM customers
WHERE state ‌IN(

'CA',  'NC',  'NY'
)
LIMIT 0 , 30

MySQL said: Documentation MySQL说:文档

#1064 - You have an error in your SQL syntax; #1064-您的SQL语法有误; check the manual that corresponds to your MySQL server version for the right syntax to use near '‌in ('CA','NC','NY') LIMIT 0, 30' at line 1 检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在第1行的'in('CA','NC','NY')LIMIT 0,30'附近使用

I has a look there http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html but I still can't find the reason why 我在那里看http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html,但是我仍然找不到原因

Thank you 谢谢

Remove the = after IN IN后删除=

SELECT name, state FROM customers 
WHERE state ‌IN ('CA','NC','NY')
SELECT name,state FROM customers WHERE state ‌IN ('CA','NC','NY')

您不能在IN中使用'='

I tried to copy your query and run it in MySQL 我试图复制您的查询并在MySQL中运行它

You have some strange "hidden" character before IN 您在IN之前有一些奇怪的“隐藏”字符

If you delete it, then everything works fine 如果删除它,那么一切正常

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

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