MySQL : AVG of AVG impossible ?

Posted by Tristan on Stack Overflow See other posts from Stack Overflow or by Tristan
Published on 2010-05-09T16:38:02Z Indexed on 2010/05/09 16:48 UTC
Read the original article Hit count: 385

Filed under:
|
|
|

Hi,

I want to do an average : the problem is for 1 item i'm calculating the AVG of each elements (working) but as soon as i want the GLOBAL average the average of the elements (something and foo) it doesn't work.

I need to do that because i want to sort the result by the global average

SELECT AVG(AVG(something)+AVG(foo)) /2 as moy
..... 
ORDER BY moy DESC

Thanks,

© Stack Overflow or respective owner

Related posts about request

Related posts about mysql-query