In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In mysql database, use SQL to calculate the amount of data within ten minutes.
Let's start with the table structure:
The desired result is: how many user_id are there every ten minutes?
Option 1:
Select from_unixtime (floor (UNIX_TIMESTAMP (start_time) / 600) * 600), COUNT (DISTINCT user_id) AS 'count' from user_live_hits_log_history
Group by FLOOR (UNIX_TIMESTAMP (start_time) / 600)
Scheme 2:SELECT RPAD (LEFT (start_time,15), 1914) AS start_time, COUNT (DISTINCT user_id) AS 'count' FROM user_live_hits_log_history GROUP BY LEFT (start_time,15)
As long as you are familiar with the application of these functions, you will find it very simple.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.