Обсуждение: Aliasing on tables ...

Поиск
Список
Период
Сортировка

Aliasing on tables ...

От
Hans-Jürgen Schönig
Дата:
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