Aggregate functions not allowed in WHERE clause - Mailing list pgsql-general

From Ricardo Naranjo Faccini
Subject Aggregate functions not allowed in WHERE clause
Date
Msg-id 1150164033.17933.1.camel@dynamic-ip-6979134229.cable.net.co
Whole thread Raw
Responses Re: Aggregate functions not allowed in WHERE clause
List 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 by date:

Previous
From: John Tregea
Date:
Subject: Re: Help with storing spatial (map coordinates) data?
Next
From: Michael Fuhr
Date:
Subject: Re: Aggregate functions not allowed in WHERE clause