4

Using a variation of the answer here using Group By, I'm trying to do a count of how many records occurred on each day of the week and display the count by the day of the week. I am getting a syntax error even though I've tried to also include DATE(ScheduleDateExact,%Y-%m-%d).

What am I doing wrong?

SELECT COUNT(WorkOrderNum)
FROM ScheduleRequest
GROUP BY DAYOFWEEK (DATE(ScheduleDateExact)) FROM ScheduleRequest
Community
  • 1
  • 1
Rocco The Taco
  • 3,695
  • 13
  • 46
  • 79

1 Answers1

4

You have a redundant from clause after the group by clause. Get rid of it, and you should be fine. I recommend, however, you add the day-of-week extraction to the select list too, so you can easily understand the results you're getting:

SELECT   DAYOFWEEK(DATE(ScheduleDateExact)), COUNT(WorkOrderNum)
FROM     ScheduleRequest
GROUP BY DAYOFWEEK(DATE(ScheduleDateExact))
Mureinik
  • 297,002
  • 52
  • 306
  • 350