mysql 分组查询的结果当成临时表 在求最大值

mac2022-06-30  64

select avg(data1) as a from temp WHERE YEAR(mdate)= 2018 and MONTH(mdate)=03 and day(mdate)=25 GROUP BY hour(mdate);

6 6 10 9 10 11 10 14 17 18 19 20 23 22 23 20 21 19 18 18 17 13 12 10

select MAX(s.a) from (select avg(data1) as a from temp WHERE YEAR(mdate)= 2018 and MONTH(mdate)=03 and day(mdate)=25 GROUP BY hour(mdate)) s;

23

转载于:https://www.cnblogs.com/zhaocundang/p/8711638.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)