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` 

解决方案 »

  1.   

    MYSQL应该会有错误提示告诉你哪儿错了。
      

  2.   

    我觉得 你至少先把  group by  子句移动到  order  by  后边 然后在进行执行试试
    如果还是报错,错误应该是出现在  聚合函数  和group by  子句的 利用上
    具体错误 请看提示
      

  3.   

    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() 
    GROUP BY a.`item_code` ,b.`description` 
    order by sum(`quantity_purchased`) desc