Gets 'best' days of week

Hi guys,

I am storing order data from our website into a mysql db, orders are dated like so ‘2009-12-22 19:44:15’

How could i pull up a list of the best days of the week for the current month?

example:

monday - 34 orders
tues - 27
etc

Any help would be greatly appeciated :slight_smile:

SLAP!!

your WHERE clause doesn’t meet the requirement for “current month”

:smiley:

Altered. :smiley:

This looks terribly inefficient, but try…


SELECT
    DAYNAME(ordered_on) as `weekday`
  , COUNT(*) as `orders`
FROM
  quote
WHERE
  MONTH(ordered_on) = MONTH(CURRENT_DATE)
GROUP BY
  DAYNAME(ordered_on)
ORDER BY
  DAYOFWEEK(ordered_on) ASC

I’ll await the usual slap from r937. :stuck_out_tongue: