names in WHERE and HAVING

Поиск
Список
Период
Сортировка
От Zachary Beane
Тема names in WHERE and HAVING
Дата
Msg-id 20001204114911.Y14297@xach.com
обсуждение исходный текст
Ответы Re: names in WHERE and HAVING  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
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/

В списке pgsql-general по дате отправления:

Предыдущее
От: Phil Steinke
Дата:
Сообщение: plpgsql variable trouble
Следующее
От: Chris Jones
Дата:
Сообщение: "temporary" table is still there