0

I looked up a few of answers but what I read did not make sense to me. I want to get the order date in the column but it gives me an error when I include it. "SELECT list is not in GROUP BY clause and contains nonaggregated column."

SELECT COUNT(`style`) AS `c`,`order_date`, `style` 
FROM `orders` 
WHERE `order_date` >= DATE(NOW()) - INTERVAL 7 DAY 
GROUP BY style

It works fine if I leave off the order_date.

SELECT COUNT(`style`) AS `c`, `style` 
FROM `orders` 
WHERE `order_date` >= DATE(NOW()) - INTERVAL 7 DAY 
GROUP BY style

What I trying to do is I want how many styles were sold between the date. I want to know who many of each style and the total of all sales.

MSC
  • 55
  • 7

0 Answers0