Aliasing on tables ...

From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: pgsql-sql(at)postgresql(dot)org
Subject: Aliasing on tables ...
Date: 2001-04-06 12:24:34
Message-ID: 3ACDB582.A43B14B7@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message lbottorff 2001-04-06 14:05:01 7.1 out soon?
Previous Message juerg.rietmann 2001-04-06 12:10:15 how to do this join ?