Re: Column name

From: "Gyozo Papp" <pgerzson(at)freestart(dot)hu>
To: "Linh Luong" <linh(dot)luong(at)computalog(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Column name
Date: 2001-05-25 10:20:15
Message-ID: 01e601c0e504$4a96ca80$3046c5d5@jaguar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

after the table alias you can rename your cloumns in join:

> select <some field>, coalesce(TRR.ABC, SOC.ABC) as newABC, ...
> from A join (B join C on (..)) on (..))
as TRR(<new column names>) <-- here

> left join
> (D join E on (..)) as SOC on (TRR.Field1=SOC.Field2)

----- Original Message -----
From: "Linh Luong" <linh(dot)luong(at)computalog(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: 2001. május 24. 21:58
Subject: [GENERAL] Column name

> Hi,
>
> I am trying to do a 2 joins between 3 tables.
>
> ie)
> select <some field>, coalesce(TRR.ABC, SOC.ABC) as newABC, ...
> from A join (B join C on (..)) on (..)) as TRR
> left join
> (D join E on (..)) as SOC on (TRR.Field1=SOC.Field2)
>
> When I run this it says that there is an ambiguous field. Yes after the
> join for TRR and SOC they both contain a fields name ABC. How can I
> rename this field in the sql statement or how can I make it so the sql
> statement know that they are different.
>
> Please help.. .thanks
>
> --
> Linh Luong
> Computalog Ltd.
> Software Developer
> Phone: (780) 464-6686 (ext 325)
> Email: linh(dot)luong(at)computalog(dot)com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Patrik Järnefelt 2001-05-25 10:32:00 JDBC
Previous Message Vctor 2001-05-25 08:49:04 Very big problem