From: chester c young <chestercyoung@yahoo.com>
To: Joel Richard <postgres@joelrichard.com>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: Converting from MS Access field aliases
Date: Thu, 12 Jul 2007 09:36:50 -0700 (PDT)
Message-ID: <746273.93291.qm@web54305.mail.re2.yahoo.com> (raw)
In-Reply-To: <E3D00FA5-C52E-4886-AB45-994162498DA8@joelrichard.com>
> SELECT field1 / 2 AS foo,
> field2 * 2 AS bar,
> foo + bar AS total
> WHERE foo < 12;
>
> The first two fields are fine, it's the third that's a problem. The
> database reports
>
> ERROR: column "foo" does not exist
>
First, I think it would be great if this worked - like the alias to an
update table added in 8.2 - saves a lot of typing and makes queries
much more readable.
Second, only way I see is to set this on top of a view generating your
foo and bar aliases, and go from there. Compared to rewriting the
expression each time, it has the advantages of better syntax in the end
and might yield better performance as well.
____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
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: chestercyoung@yahoo.com, postgres@joelrichard.com
Subject: Re: Converting from MS Access field aliases
In-Reply-To: <746273.93291.qm@web54305.mail.re2.yahoo.com>
* 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