X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DC8298B9CE6 for ; Thu, 3 Feb 2005 09:33:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12962-06 for ; Thu, 3 Feb 2005 09:33:43 +0000 (GMT) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by svr1.postgresql.org (Postfix) with ESMTP id E23A98B9F36 for ; Thu, 3 Feb 2005 09:33:44 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 4.42) id 1CwdMt-000BqU-1L; Thu, 03 Feb 2005 09:33:43 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 04602170BB; Thu, 3 Feb 2005 09:33:41 +0000 (GMT) Message-ID: <4201EFF5.5000006@archonet.com> Date: Thu, 03 Feb 2005 09:33:41 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: imam Cc: pgsql-sql@postgresql.org Subject: Re: problem while converting sybase quries to postgres References: <003901c5082d$bac76f30$1301a8c0@eipl.com> In-Reply-To: <003901c5082d$bac76f30$1301a8c0@eipl.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.172 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200502/57 X-Sequence-Number: 20168 imam wrote: > The following is a sybase query and i am trying to convet it into > postgres but in postgres the join will be specified in from clause > and we cannot specify any logical operator > > i would be grateful if you could tell me the solution for it You don't actually say what your query is trying to do. > SELECT t1.SR_TRAN_HEAD_PK AS ReceiptHeaderPK, > t1.ADJ_TRAN_ID AS AdjustmentTransactionID, ...other columns... > FROM PE_POP_SR_POSTED_TRAN_HEAD t1, > PE_POP_PO_HEADER t2, > PE_POP_SR_POSTED_TRAN_DET t3 > Where t1.SR_TRAN_HEAD_PK = t3.SR_TRAN_HEAD_PK > and (t1.PO_HEADER_PK *= t2.PO_HEADER_PK or t3.PO_HEADER_PK *= > t2.PO_HEADER_PK) If this is a left outer join, you could do something like: SELECT ... FROM pe_pop_sr_posted_tran_head t1 LEFT JOIN pe_pop_po_header t2 ON t1.po_header_pk = t2.po_header_pk LEFT JOIN pe_pop_sr_posted_tran_det t3 ON t2.po_header_pk = t3.po_header_pk AND t1.sr_tran_head_pk = t3.sr_tran_head_pk But you'll want to test it because I'm not clear what your query is doing. -- Richard Huxton Archonet Ltd