In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to achieve sql time to 5 minutes and half an hour any interval grouping, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
The problem encountered in the development is to group the time by half an hour and minutes, such as counting the number of people from 08:00 to 08:30 and the number from 08:30 to 09:00. It seems that there is no such function in sql. It can be found directly from the database. Grouping in java is too low.
Think of the custom function of method 1, realize the half-hour conversion of time by yourself, and call the function during statistics.
CREATE FUNCTION `date_half_hour_ format` (in_date TIMESTAMP) RETURNS TIMESTAMPBEGIN DECLARE out_date TIMESTAMP; DECLARE s_date VARCHAR; DECLARE s_minute VARCHAR (2); DECLARE int_minute INT; SET s_minute = SUBSTRING (in_date, 15,2); SET int_minute = CAST (s_minute AS SIGNED); IF int_minute
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.