通过在 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)
以上是在 MySQL GROUP BY 子句中使用多列有何意义?的详细内容。更多信息请关注PHP中文网其他相关文章!