I was reading the docs about SELECT and I came across this:
name
Specifies another name for a column or an expression using the
AS clause. This name is primarily used to label the column for
display. It can also be used to refer to the column's value in
ORDER BY and GROUP BY clauses. But the name cannot be used in
the WHERE or HAVING clauses; write out the expression instead.
What is the reason for this restriction? It would be a great
convenience if it were lifted.
I have several queries against another database system that do
something like this:
select name, count(*) as score
from mytable
group by name
having score > 10
PostgreSQL doesn't like them...
Zach
--
xach@xach.com Zachary Beane http://www.xach.com/