title: MySQL + ChatJS: How to group duplicated values by "day()"?
body: <p>I know there're lots of possible duplicates similar to this question, I tested all I could find but I still have an issue understanding the logic of the query...</p>
  <p>I have a bar chart which I wanna connect it to the query that showcases how many &quot;seatbelt&quot;, &quot;Speeding&quot;, etc violations happened per day.</p>
  <p>The query I have now is:</p>
  <pre><code>select violationType as 'Violations', count( DISTINCT violationType) as 'Total', day(violationDateTime) as 'Day' from traffic_violations group by day(violationDateTime);
  </code></pre>
  <p>The result:</p>
  <p><a href="https://i.stack.imgur.com/1Yr1H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Yr1H.png" alt="enter image description here" /></a></p>
  <p>Do you think the result is correct? because what I see is that &quot;wrong parking&quot; is repeated by day, yes I know it showcases how many of wrong parking happened on day 1, 2, 3 but what about &quot;Speeding&quot;? It didn't happened in day 1, nor 2,3?</p>
  <p>Basically I want to create a daily chart in the dashboard. Starts at 0 in the beginning of the day and counts up the traffic violations until the end of the day then resets the next day.</p>
  <p>I also tried this:</p>
  <pre><code>select count(id) as 'Total', violationType as 'Violation', violationDateTime as 'Date' from traffic_violations group by violationType, day(violationDateTime);
  </code></pre>
  <p>results in:</p>
  <p><a href="https://i.stack.imgur.com/yPBah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yPBah.png" alt="enter image description here" /></a></p>
  <p>Which I think is more correct than the above?</p>