标签:where esc to_char 为知笔记 round 笔记 data- mon font
mysql:
select
date_format(H_TIME,‘%H‘) as HOUR,
ROUND(AVG(H_TEMPERATURE),1) as TEMP,
ROUND(AVG(H_HUMIDITY),1) as HUMIDITY
FROM HOME_MONITOR Where date_format(H_TIME,‘%Y-%m-%d‘) = ‘2016-03-09‘
group by date_format(H_TIME,‘%H‘)
order by date_format(H_TIME,‘%H‘) desc
oracle:
select
to_char(H_TIME,‘HH24‘) as HOUR,
AVG(H_TEMPERATURE) as TEMP,
AVG(H_HUMIDITY) as HUMIDITY
FROM HOME_MONITOR Where to_char(H_TIME,‘yyyy-MM-dd‘) = ‘2016-03-09‘
group by to_char(H_TIME,‘HH24‘)
order by to_char(H_TIME,‘HH24‘) desc
查询语句,将一天所有记录按小时划分
标签:where esc to_char 为知笔记 round 笔记 data- mon font
原文地址:http://www.cnblogs.com/samwang88/p/f3c50dbc0ae723c69d5ce6dbb51dc731.html