List:General Discussion« Previous MessageNext Message »
From:Jochen Haeberle Date:May 7 1999 8:33am
Subject:Combining questions in one Select
View as plain text  

I am having problems combining several questions in one query. For 
example, I have a table containing votes on a subject, expressed in 
points (-3 lousy, -1 not very good, 0 neutral, 1 rather good, 3 very 
good or something like that). Every user is idntified by an id and 
may vote as many times as he/she would like to. But only the average 
of all his votes should go into the final sum. So I need to ask "give 
me the sum of the average vote of every client". I can get to the 
averages of every user using

Select sum(vote) / count(*) as av from votes order by user_id;

But how from here? Is there a way to sum those up?

BTW.: Is there really no average() funktion in MySQL? I could not 
find one in the manual.

Thanks for your help

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