Re: [SQL] Using Aliases in Select

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 14:06:13
Message-ID: 2928.933602773@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Christian Rudow <Christian(dot)Rudow(at)thinx(dot)ch> writes:
> select tab1.name, tab1.mytext text1, tab2.mytext text2
> from tab1, tab2
> where tab1.tab1_id = tab2.tab1_id
> ERROR: Column 'mytext' is ambiguous

As Oleg points out, you need to write AS text1 and so forth. The AS
is not optional when labeling output columns, even though you are
allowed to leave it out in the FROM list. But I am wondering about
the error message --- all the Postgres versions that I have say
ERROR: parser: parse error at or near "text1"
which may not be too helpful but at least it's not outright
misleading. What version are you using?

regards, tom lane

Browse pgsql-sql by date

  From Date Subject
Next Message Christian Rudow 1999-08-02 14:06:34 Re: [SQL] Using Aliases in Select
Previous Message Andy Lewis 1999-08-02 13:39:45 Re: [SQL] Using Aliases in Select