Forum Moderators: coopster

Message Too Old, No Replies

MySQL Error #1241 - Operand should contain 1 column(s)

PHP Query, MySQL Error

         

cameleon

5:04 pm on Jun 26, 2008 (gmt 0)

10+ Year Member



Hi Everyone,
I have this query

$query ="Select Distinct (b.imageDimension) From portfolioprice b Where b.imageSize in (SELECT a.imageId as id, a.imageName as name, a.imagePhotographe as photographe, a.imageTakeDate as tkdate, b.imageDimension as dim, b.imageSize as size, b.imagePrice as price, c.ModelName as modelName, c.ModelLastName as modelLast, c.ModelId as modelId FROM portfolio a, portfolioprice b, model c, portfoliomodel d where a.imageId=b.imageId and c.ModelId=d.imageModelId and a.imageId=d.imageId and a.imagePath='PXS20080626566DSC04816copy.jpg')";

Everytime i am running it, I get this error...

MySql Says:
#1241 - Operand should contain 1 column(s)

Can somebody helpme with that?

Thanks.

cameraman

6:30 pm on Jun 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, cameleon!

Try changing:
Select Distinct (b.imageDimension) From

to
Select Distinct b.imageDimension From

cameleon

7:03 pm on Jun 26, 2008 (gmt 0)

10+ Year Member



Hi Cameraman...
i found the problem.
In the where clause The Select Statement Should Have only ONE column to be select... I cannont have 2 or more columns.
So I simplify it like this.

Select imageDimension, imageSize, imagePrice from portfolioprice where imagePrice in(
SELECT b.imagePrice
FROM portfolio a, portfolioprice b WHERE a.imagePath = 'PXS20080626566DSC04816copy.jpg' and a.imageId=b.imageId
)

Thanks So much!

cameraman

7:16 pm on Jun 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeesh, I never even saw the second SELECT - my eyes must be going [even further].

eelixduppy

6:06 am on Jun 27, 2008 (gmt 0)



hehe

Nice work, Cameleon. Welcome to WebmasterWorld :)