How does oracle get a certain period of time
This article will explain in detail how to get a certain period of time for oracle. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Oracle fetches the data of a certain time period. The specific code is as follows:
Select count (*), T. Grouping fields from (select t. *, to_char (t. Time, 'HH24') stime,to_char (t. Time, 'HH24mi') fz,to_char (time,' d') from A twhere time > = to_date ('2019-12-01) and ghsj=0800 a group by T. The grouping field to_char (time,'d') takes what day of the week the first day of each week is Sunday to_char (t. Time, 'HH24mi') take the current hour o_char (t. Time, 'HH24') take the hour of the current time
Ps:oracle has multiple records of the same data, and the one with the largest time is selected according to the condition.
1. The first way
Select max (t1.INVALID_TIME) from T_CUSTOMER T1 where t1.customer_code = '5101'
1. The second way
SELECT INVALID_TIME FROM (SELECT * FROM T_CUSTOMER WHERE customer_code='5101' ORDER BY INVALID_TIME desc) WHERE ROWNUM = 1
1. The third way
Select INVALID_TIME from T_CUSTOMER t where INVALID_TIME= (select max (INVALID_TIME) from T_CUSTOMER where customer_code='5101') and ROWNUM = 1
5. There are multiple maximum times without filtering
Select INVALID_TIME from T_CUSTOMER t wheret.INVALID_TIME = (select max (t1.INVALID_TIME) from T_CUSTOMER T1 where t1.customer_code = '5101') this is the end of the article on "how to get a certain period of time for oracle". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.