Re: MySQL Query Question
| From: | Ignatius Reilly | Date: | Thu, 23 Jan 2003 22:43:20 +0000 |
| Subject: | Re: MySQL Query Question | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25090@lists.php.net to get a copy of this message | ||
It is safe to test if the divisor is zero:
replace
columnB/columnC
by
IF( columnC = 0, 0, columnB/columnC )
(the "0" could be anything else; this depends on your business logic)
Ignatius
____________________________________________
----- Original Message -----
From: "Jeremy" <jeremy@basinbroadband.com>
To: <php-db@lists.php.net>
Sent: Thursday, January 23, 2003 10:29 PM
Subject: [PHP-DB] MySQL Query Question
> Hello,
> 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
>
> if (columnA>'7', (columnB/columnC) + 52, columnB/ColumnC) as "Number"
>
> however i need to test if columnc is 0 also cause if i need divide by zero
i
> get a null value
>
> I cant figure out how to do this any help would be greatly appreciated
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>