On Fri, Dec 02, 2005 at 11:24:10PM -0500, Igor Tandetnik wrote:
> It is indeed an illegal SQL query. You probably want
>
> select id from test
> group by id
> having avg(rating) > 10;
I hadn't realized that my query was actually illegal. OK.
> >The workaround of putting the aggregate in a subselect works fine:
> >
> >select id from
> > (select id, avg(rating) as average from test where average > 10);
That was just my typing when I was too tired. It does not work.
Make that:
select id from
(select id, avg(rating) as average
from test where average > 10 group by id);
I've got to start just pasting in my actual queries rather than trying
to simplify them. I've messed up on that twice in a row now.
Sorry,
--nate