From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Edward Murray" <mail(at)avenuedesign(dot)net>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Left Outer Join Question |
Date: | 2002-02-27 06:04:54 |
Message-ID: | GNELIHDDFBOCMGBFGEFOGEJCCBAA.chriskl@familyhealth.com.au |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > What's probably happening is that count isn't counting NULLs?
>
> As per spec. If you want to count records independently of whether
> any particular column is NULL or not, use count(*). See the docs,
> notably
> http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/sql-ex
> pressions.html#SYNTAX-AGGREGATES
OK, Edward - I guess Tom means do this?:
select category.name, count(items.*) from category left outer join
items on (category.recordnum = items.catnum) where category.recordnum =
section_subcats.catnum and section_subcats.sectionnum = 1 and
items.clientnum = 333 group by category.name;
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | Edward Murray | 2002-02-27 06:09:50 | Re: Left Outer Join Question |
Previous Message | Edward Murray | 2002-02-27 05:59:11 | Re: Left Outer Join Question |