透過在 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中文網其他相關文章!