Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

MySQL - elaborando o AVG para um subconjunto de valores MAX


Média total dos valores máximos diários:
SELECT AVG(dailyMax) AS avgOfDailyMax
FROM (SELECT Date, MAX(Score) AS dailyMax FROM MyTable GROUP BY Date) as DailyMaxTable 

e valores máximos diários:
SELECT Date, MAX(Score) AS dailyMax
FROM MyTable
GROUP BY Date