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
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
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