Re: Question about a query with two count fields - Mailing list pgsql-general

From George Pavlov
Subject Re: Question about a query with two count fields
Date
Msg-id 8C5B026B51B6854CBE88121DBF097A8601216060@ehost010-33.exch010.intermedia.net
Whole thread Raw
In response to Re: Question about a query with two count fields  (David Fetter <david@fetter.org>)
Responses Re: Question about a query with two count fields
List pgsql-general
> 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.

pgsql-general by date:

Previous
From: "Rodrigo De León"
Date:
Subject: Re: oracle rank() over partition by queries
Next
From: "Ivan Zolotukhin"
Date:
Subject: Re: Sthange things happen: SkyTools pgbouncer is NOT a balancer