通过在GROUP BY子句中指定多个列,我们可以将结果集分成较小的组。GROUP BY子句中指定的列越多,组将越小。
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)