sql语句 查询某一天数据每个小时的数据
时间:2011-09-20
来源:互联网
from line_movement_log a
where a.CARRIER_MVT_CNTR_INTERCHG_MD ='I'
and a.cntr_status = 'XF'
and a.tractor_gate_in_datetime ??,最后这个字段是时间,我用的是oracle数据库,请高手解答,谢谢
作者: xiewenping 发布时间: 2011-09-20
如何把数据库内的数据按时间统计,要求一天的24小时每个小时都要统计,然后分别输出,比如0时有多少数据,1时有多少数据这样,select count(1)
from line_movement_log a
where a.CARRIER_MVT_CNTR_INTERCHG_MD ='I'
and a.cntr_status = 'XF'
and a.tractor_gate_in_datet……
作者: xiewenping 发布时间: 2011-09-20
from line_movement_log a
where a.CARRIER_MVT_CNTR_INTERCHG_MD ='I'
and a.cntr_status = 'XF'
and trunc(a.tractor_gate_in_datetime) = trunc(sysdate)
group by to_char(a.tractor_gate_in_datetime, 'hh24');
作者: nGX20080110 发布时间: 2011-09-20
from line_movement_log a
where 你需要的条件
group by to_char(tractor_gate_in_datetime,'yyyy-mm-dd hh24')
作者: cocolmalu 发布时间: 2011-09-20
select to_char(a.tractor_gate_in_datetime, 'hh24'), count(1)
from line_movement_log a
where a.CARRIER_MVT_CNTR_INTERCHG_MD ='I'
and a.cntr_status = 'XF'
and trunc(a.tractor_gate_in_datetime) = tru……
有问题啊 !你的语句是统计每个小时的数据 和具体哪天没有关系啊。最多24条数据。
作者: cocolmalu 发布时间: 2011-09-20
作者: cocolmalu 发布时间: 2011-09-20
select to_char(a.tractor_gate_in_datetime, 'hh24'), count(1)
from line_movement_log a
where a.CARRIER_MVT_CNTR_INTERCHG_MD ='I'
and a.cntr_status = 'XF'
and trunc(a.tractor_gate_in_datetime) = tru……
能不能在那个点为0的小时数也查询出来呢
比如,5点这个时间段统计的数据为0也显示出来
作者: xiewenping 发布时间: 2011-09-20
作者: fredrickhu 发布时间: 2011-09-20
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28