Subject | RE: [firebird-support] Select statement |
---|---|
Author | Mark Rotteveel |
Post date | 2012-10-19T07:25:23Z |
On Fri, 19 Oct 2012 07:40:32 +0200, Nols Smit <nols@...>
wrote:
So the above multiplication is identical to your original condition which
used COALESCE(<operand>, 0) = 0 on each individual operand and combined
them with OR:
COALESCE(<operand1>, 0) = 0 OR COALESCE(<operand2>, 0) = 0 OR
COALESCE(<operand3>, 0) = 0
<=>
COALESCE(<operand1> * <operand2> * <operand3>, 0) = 0
Mark
wrote:
>>No need for three COALESCEs if you want to multiply:That is the reason this is used: NULL * <number> = NULL.
>
>>and coalesce(p.total_revenue*p.exchange_rate*p.cgsshare_pct,0) = 0))
>
> There are cases where these variables may have null values.
So the above multiplication is identical to your original condition which
used COALESCE(<operand>, 0) = 0 on each individual operand and combined
them with OR:
COALESCE(<operand1>, 0) = 0 OR COALESCE(<operand2>, 0) = 0 OR
COALESCE(<operand3>, 0) = 0
<=>
COALESCE(<operand1> * <operand2> * <operand3>, 0) = 0
Mark