Skip site navigation (1) Skip section navigation (2)

Re: BUG #4037: Manual bug: 2.5. Querying a Table

From: "Daniel Cristian Cruz" <danielcristian(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4037: Manual bug: 2.5. Querying a Table
Date: 2008-03-15 18:34:54
Message-ID: 48d0cacb0803151134y116abacbv5e7722661e9b80e8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Humm...

Reading this way... It sounds like I could write something like this:

SELECT city, (temp_hi+temp_lo)/2 temp_avg, date FROM weather;

Like it work with tables...

2008/3/14, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> "Daniel Cristian Cruz" <danielcristian(at)gmail(dot)com> writes:
> > Where it says:
>
> > "Notice how the AS clause is used to relabel the output column. (The AS
> > clause is optional.)"
>
> > It's wrong, because it causes an error if executed without it.
>
> Hmm?  You can leave off the AS clause if you want:
>
> SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date FROM weather;
> SELECT city, (temp_hi+temp_lo)/2, date FROM weather;
>
>                         regards, tom lane
>



-- 
Daniel Cristian Cruz
クルズ  クリスチアン ダニエル

In response to

Responses

pgsql-bugs by date

Next:From: Alvaro HerreraDate: 2008-03-16 03:29:33
Subject: Re: BUG #4037: Manual bug: 2.5. Querying a Table
Previous:From: Sam MasonDate: 2008-03-15 14:03:39
Subject: Re: BUG #4035: sql table aliases do not work

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group