X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 776C69DC82E for ; Fri, 13 Jan 2006 11:56:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33688-01 for ; Fri, 13 Jan 2006 11:56:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 94F509DC819 for ; Fri, 13 Jan 2006 11:56:12 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k0DFuG4U025486; Fri, 13 Jan 2006 10:56:16 -0500 (EST) To: Adam Rosi-Kessel cc: pgsql-sql@postgresql.org Subject: Re: ORDER BY does not work as expected with multiple joins In-reply-to: <43C7C3E2.1030205@rosi-kessel.org> References: <43C7BA12.90103@rosi-kessel.org> <25011.1137164168@sss.pgh.pa.us> <43C7C3E2.1030205@rosi-kessel.org> Comments: In-reply-to Adam Rosi-Kessel message dated "Fri, 13 Jan 2006 10:14:42 -0500" Date: Fri, 13 Jan 2006 10:56:16 -0500 Message-ID: <25485.1137167776@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.087 required=5 tests=[AWL=0.087] X-Spam-Score: 0.087 X-Spam-Level: X-Archive-Number: 200601/65 X-Sequence-Number: 23854 Adam Rosi-Kessel writes: > But I am curious why you think a LEFT JOIN should be used rather than RIGHT > JOIN? I think I believe I am getting the desired set of records. When I > substitute LEFT JOIN for RIGHT JOIN I actually get the same result. Can you > help me understand under what conditions, in this case, I would obtain a > different result? Try some cases where there are IDs in the ID/name table that do not appear in the linking table, or the other way around. If you still like your results in those situations, then it's the right way for you. regards, tom lane