From: Hans-Jürgen Schönig <hs@cybertec.at>
To: pgsql-sql@postgresql.org
Subject: Aliasing on tables ...
Date: Fri, 06 Apr 2001 14:24:34 +0200
Message-ID: <3ACDB582.A43B14B7@cybertec.at> (raw)
Is there any possibility to access a column using the alias for the
column in the where clause?
Queries like that don't seem to work:
SELECT name || ' bought ' || amount || ' units' AS result FROM sales
where
result='abc';
ERROR: Attribute 'result' not found
That works perfectly well:
SELECT name || ' bought ' || amount || ' units' AS result FROM sales
where
name || ' bought ' || amount || ' units'='abc';
result
--------
(0 rows)
Is there any possibility to do this with PostgreSQL 7.0.3?
Hans
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: hs@cybertec.at
Subject: Re: Aliasing on tables ...
In-Reply-To: <3ACDB582.A43B14B7@cybertec.at>
References: <3ACDB582.A43B14B7@cybertec.at>
* 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