Error No. 1241 - The operand must contain 1 column (s)

I am trying to execute this QUERY and return this strange error. What does it mean?

Here is my request:

SELECT * FROM newRowP a WHERE a.rowId IN 
(SELECT * FROM newCellP b WHERE b.cellId IN 
(SELECT * FROM newproviderP c WHERE c.pId IN ('3000344','245')))
+4
source share
2 answers

In your subqueries that SELECT *return more than one column; whereas IN ()exactly one column is required to return.

+11
source

There should only be one column in the subquery returned from the statement result SELECT. eg,

SELECT * 
FROM newRowP a 
WHERE a.rowId IN (SELECT colName FROM newCellP b .....)

but the best way to use INis JOINfor tables.

SELECT  DISTINCT a.*
FROM    newRowP a
        INNER JOIN newCellP b
            ON a.rowID = b.colName
        INNER JOIN newProviderP c
            ON b.cellID = c. colName
WHERE   c.pid IN ('3000344','245')

where colnameare the columns that you want to associate with another table.

0

All Articles