Using SUM in an SQL query

后端 未结 2 1704
无人及你
无人及你 2020-12-22 14:04

I\'m trying to do a query where it adds up the totals for the orders from each customer.

I have tried a few different ways but I am not sure the right way to do it.<

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-22 14:50

    select CustomerID, count(OrderID) Orders, ShipName, sum(Total) Total
    from Order_TAB
    group by CustomerID, ShipName
    

提交回复
热议问题