RE: MySQL Query Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I need some help from you MySQL gurus out there. This is pure SQL by
the
> way..no front-end.
> 
> 
> Lets say you have a table that has 2columns.....columnA,
> ColumnB and columnC
> I have something like this

Oh CRAP! You lost me... you said two columns but listed 3! ;)
 
>  if (columnA>'7', (columnB/columnC)  + 52, columnB/ColumnC) as
"Number"

I think someone already suggested these, but either include a WHERE c !=
0 in your WHERE clause (if you don't want those rows), or use a nested
IF() to return a specific value when C is zero: 

IF(ColumnC=0,'Undef',IF(ColumnA>7,ColumnB/ColumnC+52,ColumnB/ColumnC))

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux