Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL ERROR: Operand should contain 1 column(s)

Tags:

sql

I have this query and I get error "Operand should contain 1 column(s)", whats wrong in my query?

SELECT * FROM contact AS b WHERE b.id IN 
(
    SELECT * 
    FROM contact AS e 
    WHERE e.firstname LIKE ? 
    OR e.lastname LIKE ? 
    OR e.email LIKE ? 
    OR e.phone LIKE ? 
    OR e.company LIKE ? 
    OR e.profession LIKE ? 
    OR e.mobile LIKE ?
)
like image 685
newbie Avatar asked Nov 11 '09 08:11

newbie


1 Answers

The IN operator expects a list of values which match whatever you are comparing against: the columnb.id in your case. So replace this

WHERE b.id IN (SELECT * 

with this

WHERE b.id IN (SELECT id 
like image 123
davek Avatar answered Oct 06 '22 18:10

davek