Re: [SQL] left outer join on more than 2 tables? (UNCLASSIFIED)

2009-06-17 Thread Hall, Crystal M CTR DISA JITC
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 p

Re: [SQL] left outer join on more than 2 tables? (UNCLASSIFIED)

2009-06-16 Thread Hall, Crystal M CTR DISA JITC
Classification: UNCLASSIFIED Caveats: NONE Maybe I am way of base here, but I see a reference to region in this query. However, I think count(cm.id) is correct because some would have a count of 0. Count(*) would produce counts when there are no complaints. (If I understand the logic, again, I

Re: [SQL] left outer join on more than 2 tables? (UNCLASSIFIED)

2009-06-16 Thread Hall, Crystal M CTR DISA JITC
Classification: UNCLASSIFIED Caveats: NONE Pardon my lameness, I have JUST dipped my toes in PostgreSQL and want to try this out! I'm probably wrong but here goes my very first PostgreSQL join attempt! SELECT region_name, count(complaint.id) FROM region LEFT JOIN city ON (region.id = city.reg