MySQL Forums
Forum List  »  Newbie

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
December 21, 2010 11:36AM


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.