From: tolik@aaanet.ru
To: Linh Luong <linh.luong@computalog.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Select for LEFT JOIN
Date: 29 May 2001 10:29:07 +0400
Message-ID: <861yp8mzws.fsf@tolikus.hq.aaanet.ru> (raw)
References: <3B0D7744.839FEC25@computalog.com>
>>>>> "LL" == Linh Luong <linh.luong@computalog.com> writes:
LL> Hi,
LL> I am trying to do a 2 joins between 3 tables.
LL> ie)
LL> select <some field>, 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tolik@aaanet.ru, linh.luong@computalog.com
Subject: Re: Select for LEFT JOIN
In-Reply-To: <861yp8mzws.fsf@tolikus.hq.aaanet.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox