--按分钟平均
select id,ROUND(AVG(value),2) as avg, date_format(time,'%Y-%m-%d %H:%i') as time from "
+ tablename
+ " where id in (:indexIds) and time>=:starttime and time<:endtime GROUP BY date_format(monitoring_time,'%Y-%m-%d %H:%i'),_d order by time desc
--按小时平均
select id,ROUND(AVG(value),2) as avg, date_format(time,'%Y-%m-%d %H') as time from "
+ tablename
+ " where id in (:indexIds) and time>=:starttime and time<:endtime GROUP BY date_format(monitoring_time,'%Y-%m-%d %H'),_d order by time desc
--按天平均
select id,ROUND(AVG(value),2) as avg, date_format(time,'%Y-%m-%d') as time from "
+ tablename
+ " where id in (:indexIds) and time>=:starttime and time<:endtime GROUP BY date_format(monitoring_time,'%Y-%m-%d'),_d order by time desc