From: | "George Pavlov" <gpavlov(at)mynewplace(dot)com> |
---|---|
To: | "David Fetter" <david(at)fetter(dot)org> |
Cc: | <delux256-postgresql(at)yahoo(dot)com>, "PostgreSQL GENERAL List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Question about a query with two count fields |
Date: | 2007-09-11 17:03:48 |
Message-ID: | 8C5B026B51B6854CBE88121DBF097A8601216060@ehost010-33.exch010.intermedia.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> From: David Fetter [mailto:david(at)fetter(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Ivan Zolotukhin | 2007-09-11 17:26:11 | Re: Sthange things happen: SkyTools pgbouncer is NOT a balancer |
Previous Message | Rodrigo De León | 2007-09-11 17:03:11 | Re: oracle rank() over partition by queries |