Skip navigation links

MySQL Forums :: Newbie :: Operand should contain 1 column


Advanced Search

Operand should contain 1 column
Posted by: Isaco Mua ()
Date: December 21, 2010 11:36AM

I have an IF in a select section query that i need help with...
I know this can be done with LEFT JOIN but i need this to work if possible.

this works fine:
SELECT ag . * , IF( ag.is_what = 'table2',( SELECT ac.ID FROM accounting_checks ac WHERE ac.ID=ag.related_ID ) , '' )
FROM table ag
WHERE ag.user_ID =1234

BUT this gives me an error:Operand should contain 1 column

SELECT ag . * , IF( ag.is_what = 'table2',( SELECT ac.* FROM accounting_checks ac WHERE ac.ID=ag.related_ID ) , '' )
FROM table ag
WHERE ag.user_ID =1234

Options: ReplyQuote


Subject Written By Posted
Operand should contain 1 column Isaco Mua 12/21/2010 11:36AM
Re: Operand should contain 1 column laptop alias 12/22/2010 05:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.