We can split the result set into smaller groups by specifying multiple columns in the GROUP BY clause. The more columns specified in the GROUP BY clause, the smaller the group.
mysql> Select designation, YEAR(Doj), count(*) from employees GROUP BY designation, YEAR(DoJ); +-------------+-----------+----------+ | designation | YEAR(Doj) | count(*) | +-------------+-----------+----------+ | Asso.Prof | 2013 | 1 | | Asst.Prof | 2015 | 1 | | Asst.Prof | 2016 | 1 | | Prof | 2009 | 2 | | Prof | 2010 | 1 | +-------------+-----------+----------+ 5 rows in set (0.00 sec)
The above is the detailed content of What is the significance of using multiple columns in MySQL GROUP BY clause?. For more information, please follow other related articles on the PHP Chinese website!