第1个回答 2019-08-04
select a.customerid,
a.customername,
sum(c.money) money
from customer a,
orders b,
orderitem c
where a.customerid = b.customerid
and b.orderid = c.orderid
and b.orderdate between '2019-01-01 00:00:00.000' and '2019-12-31 23:59:59.999'
group by a.customerid,
a.customername
order by money desc本回答被提问者采纳