Re: Condition in a calculated field
| От | David Johnston |
|---|---|
| Тема | Re: Condition in a calculated field |
| Дата | |
| Msg-id | CAKFQuwbNdxYVZQysNtkft2cRC7RdSnbNDpeET5KyqNgHPFiwig@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Condition in a calculated field (JORGE MALDONADO <jorgemal1960@gmail.com>) |
| Список | pgsql-novice |
I just watched the documentation and did what you suggested but I am still getting the same error message. I did the following test, what is wrong?HAVINGfacturas.fce_valor_comercial > total
It cannot see "total" because that alias is defined in the final select-list.
As I said you have to repeat the expression.
HAVING
facturas.fce_valor_comercial > sum(facsub.fce_valor_comercial)
WHERE clause is pre-grouping.
What you want is the HAVING clause - though you have to repeat the
expression (e.g., col > sum(...) ) as opposed to referring to it by name
(e.g., col > total).
http://www.postgresql.org/docs/devel/static/sql-select.html
David J.
В списке pgsql-novice по дате отправления: