I have this code that successfully displayed the number of orders according to the day-name of the week. However, I wanted to display the days name sorted accordingly.
I have this code below:
SELECT
DATENAME(dw,orderDate) AS day_of_week,
COUNT(orderID) AS total_orders
FROM
Orders
GROUP BY
DATENAME(dw,orderDate)
Here’s the output: But I wanted the Days(name) sorted from Monday, Tuesday, Wednesday.. and so on.
enter image description here
Any idea? Thank you in advance.
You need to sign in to view this answers
Leave feedback about this