X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 65323D1B80B for ; Mon, 9 Feb 2004 18:12:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51358-04 for ; Mon, 9 Feb 2004 14:12:22 -0400 (AST) Received: from boss.intranet.noze.it (unknown [213.26.229.146]) by svr1.postgresql.org (Postfix) with ESMTP id B495CD1CCA6 for ; Mon, 9 Feb 2004 14:12:20 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by boss.intranet.noze.it (Postfix) with ESMTP id 217BE2628046; Mon, 9 Feb 2004 19:12:19 +0100 (CET) Received: from boss.intranet.noze.it ([127.0.0.1]) by localhost (boss.intranet.noze.it [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 25430-04; Mon, 9 Feb 2004 19:12:18 +0100 (CET) Received: from macbeth.intranet.noze.it (macbeth.intranet.noze.it [192.168.0.70]) by boss.intranet.noze.it (Postfix) with ESMTP id 0FE63262803D; Mon, 9 Feb 2004 19:12:18 +0100 (CET) Subject: Multiple outer join on same table From: Marco Lazzeri To: pgsql-sql@postgresql.org Content-Type: text/plain Organization: noze S.r.l. Message-Id: <1076350332.31616.45.camel@macbeth.intranet.noze.it> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Mon, 09 Feb 2004 19:12:13 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at noze.it X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/91 X-Sequence-Number: 16782 Hi! I'm searching a better (quicker) way to retrieve data as I used to do using the following query... == SELECT main.codice, other.value AS value_one, other.value AS value_two FROM main LEFT OUTER JOIN other ON main.id = other.id_main LEFT OUTER JOIN other AS other2 ON main.id = other2.id_main WHERE other.type = 'type_one' AND other2.type = 'type_two'; == Thanks, Marco