Mysql group query method by time: use the function [DATE_FORMAT (date, format)], date is the field name of the time type in the table, and format time output format.
Related learning recommendations:mysql database
Mysql group query method by time:
DATE_FORMAT(date,format)
: Function is used to display date/time data in different formats.
Parameters:
#date: The name of the time type field in the table.
format: time output format.
format format:
SELECT DATE_FORMAT(come_time,'%Y') year,count(*) value FROM user where registration_time >'2017'GROUP BY year
The above is the detailed content of mysql group query by time. For more information, please follow other related articles on the PHP Chinese website!