Question

I am trying this QUERY, and return this weird error. What does it mean?

Here is my query:

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')))
Was it helpful?

Solution

Your subqueries, which SELECT *, are returning more than one column; whereas IN () requires exactly one column to be returned.

OTHER TIPS

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

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

but a better way of using IN is JOINing the 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 colname are the columns that you want to link with other table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top