X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id B23909FB28D for ; Wed, 2 Aug 2006 21:51:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 15571-08 for ; Thu, 3 Aug 2006 00:51:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpgate4.pacific.net.sg (smtpgate4.pacific.net.sg [203.81.36.24]) by postgresql.org (Postfix) with SMTP id 063E89FB286 for ; Wed, 2 Aug 2006 21:51:13 -0300 (ADT) Received: (qmail 24832 invoked from network); 3 Aug 2006 00:51:09 -0000 Received: from ppp244.dyn76.pacific.net.sg (HELO ?127.0.0.1?) (debraneys@210.24.76.244) by smtpgate4.pacific.net.sg with (DHE-RSA-AES256-SHA encrypted) ESMTPA; 3 Aug 2006 00:51:08 -0000 Message-ID: <44D14876.8090107@debraneys.com> Date: Thu, 03 Aug 2006 08:51:02 +0800 From: John Tregea User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: Aaron Bono CC: pgsql-sql@postgresql.org Subject: Re: Joining a result set from four (4) tables References: <44CDB1EF.6000508@debraneys.com> <44CE9C63.7010409@debraneys.com> <44D02242.5050309@debraneys.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.816 tagged_above=0 required=5 tests=SPF_HELO_SOFTFAIL, SPF_SOFTFAIL X-Spam-Level: *** X-Archive-Number: 200608/23 X-Sequence-Number: 25981 Hi Aaron, The query builder to generate joins that you mentioned is exactly what I am going to do doing this time. That is one of the reasons I have the generic field names for the primary and foreign key fields. Then I only have to pass the search criteria the table names and which direction I want to do the joins. Thanks again for your help. Regards John T Aaron Bono wrote: > We all find ourselves in different situations and because of that, > what works for one person, doesn't work for another - so I > understand. Good luck with the application and future queries. Maybe > you can use the existing structure of your application to help create > a query builder so you can have it write a lot of your joins for you. > That should help avoid a lot of simply typos or mix-ups when hand > writing your queries. > > I am glad the queries worked for you. > > -Aaron