Explanation
1. You can use the group by clause to divide the data in the table into several groups.
Syntax
select 查询的字段,分组函数 from 表 group by 分组的字段
2. Features
Can be grouped by a single field
With the grouping function It is best to query the fields after grouping
Group filtering
Example
SELECT MAX(salary), job_id FROM employees GROUP BY job_id;
The above is the detailed content of mysql group query example analysis. For more information, please follow other related articles on the PHP Chinese website!