MySQL COUNT Query Group by Date

Sometimes the queried data needs to be broken down into daily statistics. The statement is as follows, and you can modify it according to your situation:

Taking the user table as an example to query daily registration counts and group by day, where signupTime is the date with the format “2019-09-05 00:38:17”:

 
Query statement:
select DATE_FORMAT(signupTime,'%Y-%m-%d') days,count(uid) count from user group by days; 
 
 

Leave a Comment

Your email address will not be published.