X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B519D475F09 for ; Mon, 24 Mar 2003 10:12:36 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 9ECD0475A80 for ; Mon, 24 Mar 2003 10:12:31 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id D177CD61D; Mon, 24 Mar 2003 07:12:35 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id C6FC55C0A; Mon, 24 Mar 2003 07:12:35 -0800 (PST) Date: Mon, 24 Mar 2003 07:12:35 -0800 (PST) From: Stephan Szabo To: "Correia, Carla" Cc: "'pgsql-sql@postgresql.org'" Subject: Re: Complex outer joins? In-Reply-To: <0F232CC93A58D6119C1600B0D0799B8102338822@hamsrvmx03.logica.co.uk> Message-ID: <20030324070821.Q24147-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-26.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/547 X-Sequence-Number: 12585 On Mon, 24 Mar 2003, Correia, Carla wrote: > My problem is joins. I've seen the syntax on joins and have sucessefully > used SQLs with joins, but I've got some other big SQL statements using many > and complex > joins. > Simplified example: > > select G.SELID, G.TEXT, > L.ID as SELLEVELID , L.SELLEVEL, L.LEVELJOIN, L.LEVELTEXT, > C.ID as KRITERIENFELDID, C.SELFLD > from G, L, C > where > and G.SELID = L.SELID (+) > and L.SELID = C.SELID (+) > and L.SELLEVEL = C.SELLEVEL (+) > > How can i write this in Postgres? As the problem is that I use one same > table for varios joins. This is a problem in Postgres. Any ideas? I don't really understand the question, it looks like two levels of outer join to me, the first between g and l using selid and the second between that and c using selid and sellevel. What do you mean "one same table for various joins"?