0

I got an error code 1054, when I try to query multiple phone numbers in my statement. I am VERY new to MYSQL and can't figure out what I am doing wrong.

I can query one phone number with no problem, but if I add more than one I get the 1054 error. Can anyone give me some insight on what I am doing wrong? The code I am using is below:

SELECT
    member_id, first_name, last_name
FROM
    database_name.billing
WHERE
    phone in (‘310-123-6528’,'213-123-4564',.......);

I tried to research it and couldn't find anything, any help would be greatly appreciated!

Samvel Aleqsanyan
  • 2,812
  • 4
  • 20
  • 28
  • I copied your code, I noticed that inside the "IN" you are using different limiters, ' and '. Try to check if this is it, if it is not post your SQL tidy, please. – Matheus Sant Anna de Oliveira Apr 19 '18 at 20:27
  • https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-back-ticks-in-mysql – spencer7593 Apr 19 '18 at 20:34
  • This question serves as an example of why we should advise *against* using Microsoft Word or Outlook (with the "smart-quotes"quote character replacement feature enabled) as an editor for SQL text. And beyond just the 1054 error code, the MySQL error also includes a message that indicates what it thinks is an invalid identifier, and which part of the statement the identifier is found in. – spencer7593 Apr 20 '18 at 00:16

2 Answers2

1

you are using ´ in the first case, try use '

im037
  • 19
  • 3
0

The error message from MySQL includes the identifier (what MySQL is seeing as the column name) and which part of the statement it's finding it.

For example,

 Unknown column 'foo' in 'field list' 

... tells us that MySQL is seeing a reference to a column named foo in an expression in the SELECT list. And this

 Unknown column 'foo' in 'where clause'

tells us the problem is in the WHERE clause, MySQL is "seeing" a reference ot a column named "foo".

This information helps us figure out where the the problem is.

spencer7593
  • 106,611
  • 15
  • 112
  • 140