Statistics of mysql data according to daily, weekly and monthly grouping
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.