Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 7E97B634149 for ; Tue, 16 Jun 2009 19:45:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 91706-10 for ; Tue, 16 Jun 2009 19:45:05 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by mail.postgresql.org (Postfix) with ESMTP id 37143633645 for ; Tue, 16 Jun 2009 19:45:05 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 8so2353452qwh.61 for ; Tue, 16 Jun 2009 15:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=e6MYFhWyI9JRpkA+7AW5Jyi77sPZTaaKAXJIq+TAn0Y=; b=RUgPZMv+gaaLFWfyFiNhtx0X7hFN01SBh6ytyx9H0MCd8GKH6wNAuCi/Exf+VwiJzt Nxh5WJkReUJ6ieNsQEse7OD62MUcdb3jMR61amTOpleuPG4ZZGJj6u8hehC1vtJwilGi 7kYXrubbGtfrX8M6nguhEq0EOs1RIcVjGfVBA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=hx1T0lrKHUNJ6gVnTI6RKp0kLUDOxIGNyxKWHMaHWMzG5Z+6WeVcn+gQWYYWKg3UME A2YohxoRq48IkDz2ugQaHYiVx6VgToKdJg9ruyY4uDIGDY8enhVEVxVKcn1jdaUrFbp8 h7XuGKk7T0arKMMR0u9nD+mzuCvYcsztTcLa0= MIME-Version: 1.0 Received: by 10.220.90.209 with SMTP id j17mr6382157vcm.61.1245192303872; Tue, 16 Jun 2009 15:45:03 -0700 (PDT) In-Reply-To: References: <4A3807CF.90109@consumercontact.com> <396486430906161425i1cb7949enff5443cc2043805a@mail.gmail.com> Date: Tue, 16 Jun 2009 15:45:03 -0700 Message-ID: <396486430906161545u512acc33lbd67f78174434509@mail.gmail.com> Subject: Re: left outer join on more than 2 tables? From: Richard Broersma To: Gavin Baumanis Cc: Carol Cheung , pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/79 X-Sequence-Number: 32684 On Tue, Jun 16, 2009 at 2:39 PM, Gavin Baumanis wrot= e: > 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 > =A0 =A0R.region_name, > =A0 =A0Count(*) AS RegionComplaints > FROM > =A0 =A0Region AS R > =A0 =A0 =A0 =A0LEFT JOIN City AS Ci > =A0 =A0 =A0 =A0 =A0 =A0LEFT JOIN Complaint AS Cm ON Ci.id =3D Cm.city_id > =A0 =A0 =A0ON R.id =3D C.region_id > GROUP BY > =A0 =A0R.region_name; Yup, it produces the same result. --=20 Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug