Oracle取某时间段的数据: sysdate+1是加一天,sysdate+/-(1/48)就是加/减 半个小时 select count(*) from table_name wher
Oracle取某时间段的数据:
sysdate+1是加一天,sysdate+/-(1/48)就是加/减 半个小时
select count(*) from table_name where table_name.date between to_char(sysdate-1/48,'yyyymmdd HH:mi') and sysdate
其中date为你要统计的字段名字
table_name为表的名字
to_char是一个日期函数 to_char(sysdate,'yyyymmdd HH:mi') 为截取到分钟,对应的to_char(sysdate,'yyyymmdd HH')为截取到小时。to_char(sysdate,'yyyymm')为截取到月份,
,Copyright © 2019- baoaiwan.cn 版权所有 赣ICP备2024042794号-3
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务