Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How do you sum the max values of each day using a query mysql The one below I at

ID: 3696500 • Letter: H

Question

How do you sum the max values of each day using a query mysql The one below I attempted is not working

SELECT DATE_FORMAT(orderDate,'%W, %M %e, %Y') orderDate, SUM(Count) sumCount
                           FROM
                                   (
                                   SELECT DATE_FORMAT(orderDate,'%M %e, %Y') orderDate, MAX(Count) AS maxCount
                                   FROM testLocation
                               WHERE orderDate >= '$data1' AND orderDate < '$data2' + INTERVAL 1 DAY
                                   )
                           GROUP BY MONTH(orderDate)

Explanation / Answer

Here in this case you have used to do the group by on the bases of month only, but in group by also add the date as well as given below:

GROUP BY DATE(orderDate), MONTH(orderDate)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote