> From: David Fetter [mailto:david@fetter.org]
> On Tue, Sep 11, 2007 at 08:55:53AM -0700, George Pavlov wrote:
> > sum(case when z!=0 then 1 end) as good,
>
> This case statement returns true when z factorial is zero, so I'd
> recommend the SQL standard <> or IS NOT DISTINCT FROM instead.
and what would be that number that has its factorial = 0 ?! (just giving
you a hard time this not being a math forum...)
thanks dave, you do bring a valid point of there being ambiguity about
the ! and that might be worth noting in the manual
(http://www.postgresql.org/docs/8.2/interactive/functions-comparison.htm
l). however, it seems that our favorite DBMS does the right thing and
gives precedence to the != as "not equal", so taking a more realistic
example (non-zero factorials):
foo=> select 2 != 2;
?column?
----------
f
(1 row)
foo=> select 2 <> 2;
?column?
----------
f
(1 row)
foo=> select (2 !)= 2;
?column?
----------
t
(1 row)
i do hate potential ambiguity... the != was something stuck in my brain
from old sybase, i think. i always liked != ("not equals") as more
intuitive than <> ("less than, greater than"???), but i will have to
change my ways, especially if "the standard" says so.