From: | "Hall, Crystal M CTR DISA JITC" <Crystal(dot)Hall(dot)ctr(at)disa(dot)mil> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: left outer join on more than 2 tables? (UNCLASSIFIED) |
Date: | 2009-06-17 15:06:19 |
Message-ID: | 00E9117C300386479B7E2F3CDBF798F605534294@pothia.disanet.disa-u.mil |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Classification: UNCLASSIFIED
Caveats: NONE
My problem with that is that you are counting rows per region and you have done a left jion on region. That means there will be at least one row per region even if there are 0 compliants. It might yield the same result now, but if you even have a period where a region recieves no complaints they will have a complaint count of 1 instead of 0. That is just my guess based on the logic.
-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Richard Broersma
Sent: Tuesday, June 16, 2009 3:50 PM
To: Rob Sargent
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] left outer join on more than 2 tables?
On Tue, Jun 16, 2009 at 2:40 PM, Rob Sargent<robjsargent(at)gmail(dot)com> wrote:
> Is there a city without a reference to region?
I don't know, but the OP wanted to know complaints by region.
> And wouldn't you want to count(cm.id)?
Count(cm.id) and Count(*) produce the same result. But I like
Count(*) more since it helps to correctly express the idea that we are counting rows per group and not cm.id(s) per group.
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug
--
Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
Classification: UNCLASSIFIED
Caveats: NONE
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Duffy | 2009-06-17 20:26:43 | Trapping statement timeout |
Previous Message | Carol Cheung | 2009-06-17 13:07:23 | Re: left outer join on more than 2 tables? |