Received: from aaanet.ru (pa.aaanet.ru [213.59.98.223]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4T6T7E90665 for ; Tue, 29 May 2001 02:29:08 -0400 (EDT) (envelope-from tolik@tolikus.hq.aaanet.ru) Received: from [213.59.113.17] (helo=tolikus.hq.aaanet.ru) by aaanet.ru with esmtp (Exim 3.16 #1) id 154d05-0005nB-00; Tue, 29 May 2001 10:29:05 +0400 Received: (from tolik@localhost) by tolikus.hq.aaanet.ru (8.9.3/8.9.3) id KAA11561; Tue, 29 May 2001 10:29:07 +0400 (MSD) (envelope-from tolik) To: Linh Luong Cc: pgsql-sql@postgresql.org Subject: Re: Select for LEFT JOIN References: <3B0D7744.839FEC25@computalog.com> Mime-Version: 1.0 (generated by tm-edit 1.5) Content-Type: text/plain; charset=US-ASCII From: tolik@aaanet.ru (Anatoly K. Lasareff) Date: 29 May 2001 10:29:07 +0400 In-Reply-To: Linh Luong's message of "Thu, 24 May 2001 15:04:04 -0600" Message-ID: <861yp8mzws.fsf@tolikus.hq.aaanet.ru> Lines: 29 X-Mailer: Gnus v5.6.45/XEmacs 21.1 - "Canyonlands" X-Archive-Number: 200105/305 X-Sequence-Number: 3146 >>>>> "LL" == Linh Luong writes: LL> Hi, LL> I am trying to do a 2 joins between 3 tables. LL> ie) LL> select , coalesce(TRR.ABC, SOC.ABC) as newABC, ... LL> from A join (B join C on (..)) on (..)) as TRR LL> left join LL> (D join E on (..)) as SOC on (TRR.Field1=SOC.Field2) LL> When I run this it says that there is an ambiguous field. Yes after the LL> join for TRR and SOC they both contain a fields name ABC. How can I LL> rename this field in the sql statement or how can I make it so the sql LL> statement know that they are different. LL> Please help.. .thanks You have to use full-qualifyed field names, like this: select trr.abc, soc.abc,.... In addition you can use aliases for field names: select trr.abc as abc1, soc.abc as abc2, .... -- Anatoly K. Lasareff Email: tolik@aaanet.ru http://tolikus.hq.aaanet.ru:8080