Reputation: 561
I'm attempting to separate my database entries into the number of entries that fall on each day of the week (Mon=43, Tue=35...) with no regard for month or year. The result from the query below return eight results instead of seven and the number of results for each day is incorrect.
SELECT COUNT(*) FROM table GROUP BY DAYOFWEEK(date)
Example of my table:
date
07/11/13
07/16/13
07/17/13
07/24/13
07/26/13
07/26/13
Am I using DAYOFWEEK correctly?
Upvotes: 0
Views: 64
Reputation: 607
I would suggest to change your query as follow:
SELECT DAYOFWEEK(date), COUNT(*) FROM table GROUP BY DAYOFWEEK(date)
so you can better understand if there's something wrong, anyway: yes you're using dayofweek correctly. I am a bit surprised by the fact that you get 8 results... can you show us the results please?
Gnagno
Upvotes: 0