Re: [SQL] Using Aliases in Select

From: Andy Lewis <alewis(at)themecca(dot)net>
To: Christian Rudow <Christian(dot)Rudow(at)thinx(dot)ch>
Cc: PostgreSQL SQL <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] Using Aliases in Select
Date: 1999-08-02 13:39:45
Message-ID: Pine.LNX.4.05.9908020838110.9077-100000@tmg.themecca.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'll take a stab at this one:

Try:
select tab1.name, tab1.mytext as text1, tab2.mytext as text2
from tab1, tab2 where tab1.tab1_id = tab2.tab1_id

I believe that this will fix it.

Andy

On Mon, 2 Aug 1999, Christian Rudow wrote:

> I join 2 tables that both have a row "mytext".
> I want to use both text fields in the select (projection) clause, giving
> alias names to them.
>
> select tab1.name, tab1.mytext text1, tab2.mytext text2
> from tab1, tab2
> where tab1.tab1_id = tab2.tab1_id
>
> but ...
>
> ERROR: Column 'mytext' is ambiguous
>
> Is there a solution to this ?
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Christian Rudow E-Mail: Christian(dot)Rudow(at)thinx(dot)ch
> ThinX networked business services Stahlrain 10, CH-5200 Brugg
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-08-02 14:06:13 Re: [SQL] Using Aliases in Select
Previous Message Christian Rudow 1999-08-02 13:22:36 Using Aliases in Select