select a.`item_code`,sum(`quantity_purchased`),b.`description`
from `1_sale_orders` a left join `1_product` b on a.`item_code`=b.`item_code`
where a.date(`upload_date`)=CURDATE()
order by sum(`quantity_purchased`) desc
GROUP BY a.`item_code`
from `1_sale_orders` a left join `1_product` b on a.`item_code`=b.`item_code`
where a.date(`upload_date`)=CURDATE()
order by sum(`quantity_purchased`) desc
GROUP BY a.`item_code`
如果还是报错,错误应该是出现在 聚合函数 和group by 子句的 利用上
具体错误 请看提示
from `1_sale_orders` a left join `1_product` b on a.`item_code`=b.`item_code`
where a.date(`upload_date`)=CURDATE()
GROUP BY a.`item_code` ,b.`description`
order by sum(`quantity_purchased`) desc