List:General Discussion« Previous MessageNext Message »
From:Jochen Haeberle Date:May 10 1999 5:21am
Subject:Re: Combining questions in one Select
View as plain text  
Hi,

At 12:06 Uhr +0300 07.05.1999, Johan Engstr–m 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
>
>AVG(expr)
>    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???

Jochen

Thread
Combining questions in one SelectJochen Haeberle7 May
  • Re: Combining questions in one Selectjohan.engstrom7 May
    • Re: Combining questions in one SelectJochen Haeberle10 May
      • Re: Combining questions in one SelectLuuk de Boer10 May