sql 每天查询一条记录 查出每天某个字段 最大值 最小值 平均值
select to_char(TIME, 'yyyy-mm-dd') as time,
round(max(visibility), 0) as maxnum,
round(min(visibility), 0) as minnum,
round(avg(visibility), 0) as avgnum
from table_name
where id = 200
and TIME
between to_date('2021-02-1 00:00:00', 'yyyy-mm-dd,hh24:mi:ss')
and to_date('2021-02-10 00:00:00', 'yyyy-mm-dd,hh24:mi:ss')
group by to_char(TIME, 'yyyy-mm-dd')
order by to_char(TIME, 'yyyy-mm-dd')