Aggregates in WHERE clause? - Mailing list pgsql-sql

From Ruben Gouveia
Subject Aggregates in WHERE clause?
Date
Msg-id 51e507b0809101611x230bf7a6if0da0760108986ea@mail.gmail.com
Whole thread Raw
Responses Re: Aggregates in WHERE clause?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Aggregates in WHERE clause?  ("Richard Broersma" <richard.broersma@gmail.com>)
Re: Aggregates in WHERE clause?  ("Igor Neyman" <ineyman@perceptron.com>)
List pgsql-sql
<div dir="ltr">I tried to do the following and got the following error message:<br /><br /><span style="color: rgb(51,
51,255);">select employee,count(distinct tasks)</span><br style="color: rgb(51, 51, 255);" /><span style="color:
rgb(51,51, 255);">        from job</span><br style="color: rgb(51, 51, 255);" /><span style="color: rgb(51, 51,
255);">       where greatest(max(last_job_date),max(last_position_date)) < 2008-08-28 + integer '1'</span><br
style="color:rgb(51, 51, 255);" /><span style="color: rgb(51, 51, 255);">        group by employee;</span><br /><br
/><fontcolor="#cc0000">ERROR:  aggregates not allowed in WHERE clause<br /><br />********** Error **********<br /><br
/>ERROR:aggregates not allowed in WHERE clause<br />SQL state: 42803</font><br /><br />Is there away around this?
Shouldi create a function to populate a variable that can be used in it's place...will that even work?<br /><br /><br
/></div>

pgsql-sql by date:

Previous
From: Emi Lu
Date:
Subject: pg_restore in java connection (auto_commit = false)
Next
From: Stephan Szabo
Date:
Subject: Re: Aggregates in WHERE clause?