Re: Problem with IF() inside of a select statement

2010-07-11 Thread Shawn Green (MySQL)
On 7/8/2010 10:59 AM, John Nichel wrote: Hi, I'm hoping what I'm trying to do can be done, but I can't seem to find the right syntax. I have the following query: SELECT ... snipped ... if( (

Re: Problem with IF() inside of a select statement

2010-07-08 Thread Peter Brawley
Is there a way I can do a IF((SELECT.), expr2, expr3) and have expr2 populate with whatever is returned from the select statement? Yes, select if( (select count(*) from mytable ) 100, 1, 0) works fine. The alias inside your last If(...), though, is not visible outside its parentheses;

RE: Problem with IF() inside of a select statement

2010-07-08 Thread John Nichel
-Original Message- From: Peter Brawley [mailto:peter.braw...@earthlink.net] Sent: Thursday, July 08, 2010 12:27 PM To: mysql@lists.mysql.com Subject: Re: Problem with IF() inside of a select statement Is there a way I can do a IF((SELECT.), expr2, expr3) and have expr2