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 17BBD11F7D71 for ; Tue, 18 Apr 2006 18:11:32 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.55 X-Spam-Level: X-Spam-Status: No, score=0.55 required=5 tests=[NO_REAL_NAME=0.55] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id ZR6O8zv-3BWn for ; Tue, 18 Apr 2006 18:11:13 -0300 (ADT) X-Greylist: delayed 00:31:32.253195 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 0B09A11F782C for ; Tue, 18 Apr 2006 18:11:12 -0300 (ADT) Received: from resolution.com (unknown [65.18.201.170]) by svr4.postgresql.org (Postfix) with ESMTP id D25D55AF027 for ; Tue, 18 Apr 2006 20:39:41 +0000 (GMT) Received: (from resolutio@localhost) by resolution.com (8.12.10/8.11.2) id k3IKdZ1v012275 for pgsql-sql@postgresql.org; Tue, 18 Apr 2006 16:39:35 -0400 From: gurkan@resolution.com X-Authentication-Warning: resolution.com: resolutio set sender to gurkan@resolution.com using -f To: pgsql-sql@postgresql.org Subject: Complex Informix OUTER Message-ID: <1145392775.44454e87a8762@www.resolution.com> Date: Tue, 18 Apr 2006 16:39:35 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.8 X-Originating-IP: 216.63.139.110 X-Archive-Number: 200604/123 X-Sequence-Number: 24932 Hi all. I have a fairly complicated Informix OUTER needs to be converted to PostgreSQL and I cannot get around it. For me it is fairly complicated Problem is inv_contracts OUTERS from three different tables and two out of these three (invention, 'dbuser as con') needs to SELECT for data (invention.name as inv_name, con.lastname as con_lastname, con.firstname as con_firstname) Thanks for help. First thought would be below but not allowed, inv_contracts needs to be renamed and that wont be the correct conversion. ,invention LEFT OUTER JOIN inv_contracts ON inv_contracts.inv_id = invid ,dbuser as con LEFT OUTER JOIN inv_contracts ON inv_contracts.con_id = con.id ,contractDef LEFT OUTER JOIN inv_contracts ON inv_contracts.contract_id IN (select id FROM contractDef WHERE phase_id = 2); Possible sub-queries may not be the solution because I need to be able to some selects from 'dbuser as con' and invention. Thanks. Any help appriciated. --ORIGINAL INFORMIX OUTER QUERY SELECT user.username, user.firstname, user.lastname, add1, add2, city, stateDef.abbreviation as state, zip, invention.inv_number as invnum, invention.name as inv_name, con.lastname as con_lastname, con.firstname as con_firstname FROM user, ascpDef AS stateDef, address, invention, user as con , OUTER inv_contracts WHERE address.type = 'User' AND address_id = 1 AND user.id = address.type_id AND state_id = stateDef.id AND invention.user_id = user.id AND invention.inv_number = '1994376-A' AND inv_contracts.inv_id = invention.id AND inv_contracts.con_id = con.id AND inv_contracts.contract_id IN (select id FROM contractDef WHERE phase_id = 2); ------------------------------------------------- This mail sent through IMP: www.resolution.com