11-09-05 10:45 PM
Hi Rick,
That's exactly what I was trying to find out. You just saved me a few
hours beating my head against the SQL spec.
Thanks,
Craig
On Nov 9, 2005, at 11:25 AM, Rick Hillegas wrote:
> Hi Craig,
>
> I hope I am answering the correct question here. The behavior of
> aggregates is described in Part 2 of the ANSI spec, section 10.9.
>
> 1) A null column is excluded from a COUNT( colName ) aggregate.
> This is described in the section 10.9 under General Rules 4a. The
> database is supposed to raise a warning: "warning--null value
> eliminated in set function"
>
> 2) Unless you specify the DISTINCT keyword, the COUNT aggregate
> will not filter out duplicates. Each row, regardless of whether it
> is a duplicate, will go into the tally. This is described in the
> same section underGeneral Rules 4b.
>
> For the record, Derby exhibits this ANSI behavior. To summarize:
>
> -- the following query eliminates rows with null in column "a"
> select count( a ) from foo;
>
> -- the following query eliminates rows with null in column "a"
> -- and eliminates duplicates
> select count( distinct a ) from foo;
>
> Cheers,
> -Rick
>
> Craig L Russell wrote:
>
>
>
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell-xsfywfwIY+M@public.gmane.org
P.S. A good JDO? O, Gasp!
[ Post a follow-up to this message ]
|