Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does oracle get a certain period of time

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report