Get the App
SLTechnology News&Howtos  ›  Database  › 

Statistics of mysql data according to daily, weekly and monthly grouping

Shulou Source: shulou.com Published: 2022-06-01 19:11:08 09月30日 Update

The following is about the statistics of mysql data according to daily, weekly and monthly groups. the secret of the text is that it is close to the topic. So, let's not talk about gossip. let's read the following directly. I believe you will benefit from reading the mysql data according to daily, weekly and monthly grouping statistics.

According to daily statistics:

Select year (create_datetime), month (create_datetime), day (create_datetime), count (*) from redpacket group by year (create_datetime), month (create_datetime), day (create_datetime)

According to weekly statistics:

Select FROM_DAYS (TO_DAYS (create_datetime)-MOD (TO_DAYS (create_datetime)-2,7)) AS week from redpacket group by week

According to monthly statistics:

Select count (*) from redpacket group by year (create_datetime), month (create_datetime)

For the above statistical mysql data according to daily, weekly and monthly groups, is there anything else you don't understand? Or if you want to know more about it, you can continue to follow our industry information section.

Tags: Statistics data grouping the following topics content places mysteries text more plates articles industries information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MariaDB Shulou Tech Info MySQL Microsoft