In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how Oracle query 2 dates across the month list / date list, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Basic logic formula:
Select Rownum, start date + Rownum-1 from dual connect by rownum < end date-start date + 2
two。 Query the yyyy-mm-dd list of dates crossed by 2 dates:
Query results:
SQL code (start time: 2019-01-22, end time: 2019-01-02):
Select Rownum, to_date ('2019-01-02,' yyyy-mm-dd') + Rownum-1from dualconnect by rownum < to_date ('2019-01-22,' yyyy-mm-dd')-to_date ('2019-01-02,' yyyy-mm-dd') + 2
3. Query the yyyy-mm list of months spanned by 2 dates:
Query results:
SQL code (start time: 2020-03-15, end time: 2019-01-02):
Select ss.DAY_ID from (SELECT TO_CHAR (TO_DATE ('2019-01-02)) + ROWNUM-1,' YYYY-MM') DAY_IDfrom dualconnect by rownum < to_date ('2020-03-15,' yyyy-mm-dd')-to_date ('2019-01-02' 'yyyy-mm-dd') + 2) ss GROUP BY DAY_ID ORDER BY DAY_ID and above are all the contents of the article "how to query the month list / date list crossed by 2 dates by Oracle" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.