1

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

SELECT name, state
FROM customers
WHERE state ‌IN(

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

MySQL said: Documentation

#1064 - 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 '‌in ('CA','NC','NY') LIMIT 0, 30' at line 1

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

Thank you

juergen d
  • 201,996
  • 37
  • 293
  • 362
user1805
  • 187
  • 2
  • 6
  • 15
  • The 1064 error should be followed by "near "... which points to exactly what is causing a problem (in most cases) – Michael Berkowski Oct 28 '13 at 14:01
  • The error is the `=` at `state IN =(...)` Should just be `state IN (...)` – Michael Berkowski Oct 28 '13 at 14:02
  • If you edited it and still receive an error from that query (which is syntactically valid) you must post the full error, _and_ any other surrounding code, such as if you attempted to execute 2 queries at once... – Michael Berkowski Oct 28 '13 at 14:06
  • There is the full error, its the same as above SQL query: Documentation SELECT name, state FROM customers WHERE state ‌in( 'CA', 'NC', 'NY' ) LIMIT 0 , 30 MySQL said: Documentation #1064 - 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 '‌in ('CA','NC','NY') LIMIT 0, 30' at line 1 thats why I dont understand, the query looks ok – user1805 Oct 28 '13 at 14:09
  • the command is SELECT name,state FROM customers WHERE state ‌in ('CA','NC','NY') – user1805 Oct 28 '13 at 14:10
  • `near '‌in` There you have it... What looks like plain whitespace on your screen is actually some non-printable character. Delete the space there and retype it. – Michael Berkowski Oct 28 '13 at 14:16

3 Answers3

2

Remove the = after IN

SELECT name, state FROM customers 
WHERE state ‌IN ('CA','NC','NY')
juergen d
  • 201,996
  • 37
  • 293
  • 362
  • sorry, I had initially removed the = after in.I just added it to see if that solved the issue.Without the = sign, I still have the same issue.Thank you – user1805 Oct 28 '13 at 14:05
  • 2
    You habe a special character in your query. Retype it and it will work. – juergen d Oct 28 '13 at 14:12
0
SELECT name,state FROM customers WHERE state ‌IN ('CA','NC','NY')

You can not use the '=' with an IN

Mihai
  • 26,325
  • 7
  • 66
  • 81
Turbofant
  • 517
  • 11
  • 24
0

I tried to copy your query and run it in MySQL

You have some strange "hidden" character before IN

If you delete it, then everything works fine

marcosh
  • 8,780
  • 5
  • 44
  • 74