sql >> Base de Datos >  >> RDS >> Mysql

MySQL:calcular el AVG para un subconjunto de valores MAX

Promedio total de valores máximos diarios:

SELECT AVG(dailyMax) AS avgOfDailyMax
FROM (SELECT Date, MAX(Score) AS dailyMax FROM MyTable GROUP BY Date) as DailyMaxTable 

y valores máximos diarios:

SELECT Date, MAX(Score) AS dailyMax
FROM MyTable
GROUP BY Date