From: Richard Broersma <richard.broersma@gmail.com>
To: Gavin Baumanis <gavinb@eclinic.com.au>
Cc: Carol Cheung <cacheung@consumercontact.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: left outer join on more than 2 tables?
Date: Tue, 16 Jun 2009 15:45:03 -0700
Message-ID: <396486430906161545u512acc33lbd67f78174434509@mail.gmail.com> (raw)
In-Reply-To: <E8B4F516-1647-4621-B744-5DB66E1EC682@eclinic.com.au>
References: <4A3807CF.90109@consumercontact.com>
<396486430906161425i1cb7949enff5443cc2043805a@mail.gmail.com>
<E8B4F516-1647-4621-B744-5DB66E1EC682@eclinic.com.au>
On Tue, Jun 16, 2009 at 2:39 PM, Gavin Baumanis<gavinb@eclinic.com.au> wrote:
> At the risk of being wrong.... (I'm always ready to learn something new) -
> and seemingly I'm only too happy to be wrong!...
>
> And... it might even be that it is exactly the same result - but I would
> have proposed;
>
> SELECT
> R.region_name,
> Count(*) AS RegionComplaints
> FROM
> Region AS R
> LEFT JOIN City AS Ci
> LEFT JOIN Complaint AS Cm ON Ci.id = Cm.city_id
> ON R.id = C.region_id
> GROUP BY
> R.region_name;
Yup, it produces the same result.
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: richard.broersma@gmail.com, gavinb@eclinic.com.au, cacheung@consumercontact.com
Subject: Re: left outer join on more than 2 tables?
In-Reply-To: <396486430906161545u512acc33lbd67f78174434509@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox