Aggregate functions not allowed in WHERE clause

Поиск
Список
Период
Сортировка
От Ricardo Naranjo Faccini
Тема Aggregate functions not allowed in WHERE clause
Дата
Msg-id 1150164033.17933.1.camel@dynamic-ip-6979134229.cable.net.co
обсуждение исходный текст
Ответы Re: Aggregate functions not allowed in WHERE clause  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
I have two tables, Claims and Logs, and I need to fish in for the id of
any
claim who have into the logs anything into the fields invoices or
payments

I think the best way to do this is by mean of:

SELECT claim_id
FROM logs
WHERE (
    sum(logs.invoices) > 0
    OR
    sum(logs.payments) > 0
)
GROUP BY claim_id

But Postgres claims "Aggregate functions not allowed in WHERE clause"

Anyone could help me to figure out this task please

Cordially
--
   @..@      Ricardo Naranjo Faccini            Tel: (1) 257-9832
  (----)     Ingeniero Civil                    Calle 95 #30-61 int 8
 ( >__< )    M.Sc. Ing. de Sistemas y Comp.     Barrio La Castellana
 ^^ ~~ ^^    gerencia@skinait.com               Bogotá D.C.
   SKINA                                        Colombia, S.A.
IT Solutions http://www.skinait.com


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

Предыдущее
От: John Tregea
Дата:
Сообщение: Re: Help with storing spatial (map coordinates) data?
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Aggregate functions not allowed in WHERE clause