Home >Database >Mysql Tutorial >Oracle取某时间段的数据

Oracle取某时间段的数据

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:16:541812browse

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')为截取到月份,

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn