0.美图
1.按小时分组查询
需求:根据小时统计,每小时发生的数据量
实现效果
解释:
- 左边查询
SELECT
afsj_ks , ajlb_mx
FROM
XTBA_AJ
WHERE
afdgxs LIKE '340503%'
AND '2017-05-01 00:00:00' <= afsj_ks
AND afsj_ks < '2017-05-31 00:00:00'
AND ajlb_mx = '扒窃'
改进
SELECT
afsj_ks , ajlb_mx,date_part('hour', afsj_ks) as myhour
FROM
XTBA_AJ
WHERE
afdgxs LIKE '340503%'
AND '2017-05-01 00:00: