How to use mysql to calculate the maximum unlogged-in period for users this year
Editor to share with you how to use mysql to calculate the maximum unlogged-in period of users this year, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!
Calculate the maximum period during which users are not logged in this year
Space_user_task_statistics_log if the user has logged in, the information is recorded in the table
The main information includes user ID and login time.
Space_user records the basic information of users. It mainly includes user ID and registration time information.
Demand:
Check the largest unlogged-in period for all users in 2017
If the user registers only in 2017, the valid time starts from the registration time.
In fact, this is a problem of MySQL computing continuous range.
SQL