用SQL语句,查询2019年所有客户的订单总金额,并按总金额从大到小排序。(客户表customer, 订单表orders, 订单明细表orderitem) ?
SELECT sum(i.订单金额) from orderitem i, orders o, customer c on i.订单Id=o.订单Id and on c.客户Id=o.客户Id where year(i.订单时间)='2019' GROUP BY c.客户Id order BY sum(i.订单金额) desc
https://zhidao.baidu.com/question/246562557979982404.html