title: Counting Occurrences of Day Names By Distinct Weeks
body: <p>Apologies in advance if this question is badly worded!</p>
  
  <p>I have a MySQL table which has a datetime field. How would one count the number of occurrences of each day name, for distinct weeks?</p>
  
  <p>Here is the query I'm trying, and the result it gives from just over 2 weeks of data. It is (obviously) counting every occurrence for each record, whereas I want the output to be either 2 or 3.</p>
  
  <pre><code>SELECT dayname(datetime), COUNT(dayofweek(datetime)) 
     FROM mytable GROUP BY dayofweek(datetime);
  
  +-------------------+----------------------------+
  | dayname(datetime) | count(dayofweek(datetime)) |
  +-------------------+----------------------------+
  | Monday            |                        404 |
  | Tuesday           |                        275 |
  | Wednesday         |                        251 |
  | Thursday          |                        196 |
  | Friday            |                        201 |
  | Saturday          |                        128 |
  +-------------------+----------------------------+
  </code></pre>
  
  <p>Grouping by week did not solve the problem. I feel as though I need to "count where week is distinct" but I'm not sure if this is possible.</p>
  
  <p>Any guidance is much appreciated, thank you!</p>