[英]SQL Group dates by day of week and get count
I have a table with a bunch of dates in it and I need to convert those dates to what day of the week it is and then group them. 我的桌子上有一堆日期,我需要将这些日期转换成星期几,然后将它们分组。
Example output looks like 示例输出看起来像
+------------+-------+
| Date | Count |
+------------+-------+
| 11/12/2018 | 1 |
| 11/19/2018 | 2 |
| 11/20/2018 | 1 |
| 11/21/2018 | 2 |
+------------+-------+
The output that I would like would be 我想要的输出是
+-----------+-------+
| DayName | Count |
+-----------+-------+
| Monday | 3 |
| Tuesday | 1 |
| Wednesday | 2 |
+-----------+-------+
Im just unsure on how to rename the dates to the day of the week and have them group together. 我只是不确定如何将日期重命名为星期几并将它们组合在一起。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.