On 10 May 99, at 7:21, Jochen Haeberle wrote:
> At 12:06 Uhr +0300 07.05.1999, Johan Engstrm wrote:
> > > BTW.: Is there really no average() funktion in MySQL? I could not find
> > > one in the manual.
> >Straight from the manual:
> >7.3.12 Functions for use with GROUP BY clauses
> > Returns the average value of expr.
> You are right. I could not find it because avg(expr) does not show up in
> the TOC-page.
> This way I can easily get all average votes of different users:
> Select avg(vote) from votes gropu by voter_id;
> But I am still unable to get the sum of all votes, as using
> sum(avg(vote)) gives an ERROR 1111: Invalid use of group function.
> As every subject has another ID, I could use an Order By on this to
> create a sum, but it does not work either.
> Is there a way to get a one line result for the above querry that
> shows the sum of all the averages???
did you tried something like:
select sum(avg(vote)) as totalnr from x order by totalnr