oracle data fetch a certain time (a few mornings a week to a few points)

 select count (*), t. packet field from (
SELECT T. *, TO_CHAR (T. time, 'HH24') stime, to_char (t. Time, 'HH24mi') fz, to_char ( time, 'D') 
from T A
WHERE time> = to_date ( '2019-12-01', 'yyyy-MM-dd') and ghsj <= to_date ( '2019-12-31', 'yyyy-MM-dd') and to_char ( time , 'D') = '2'
) in stime WHERE ( '08', '09', '10', '. 11', '12 is') and FZ> = 0800 A 
Group by T. packet field

 

TO_CHAR (time, 'd') a few take the current time day of the week for the first week Sun. 

to_char (t. Time, 'HH24mi') takes the current time minutes hours

o_char (t time, 'HH24'.) Take the current time hour
----------------
Disclaimer: This article is CSDN blogger "Chen demon" in the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/chenxiaojie_26/article/details/103823260

Guess you like

Origin www.cnblogs.com/chenxiaoyao/p/12145813.html