Group by two columns and display grand total in every row

后端 未结 6 1056
太阳男子
太阳男子 2020-12-06 05:00

Below are the list data.

Code   ItemCount   Type      Amount 
----------------------------------------
B001    1          Dell         10.00
B001    1                


        
6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 05:31

    Please try:

    SELECT
        Code,
        SUM(ItemCount) ItemCount,
        Type,
        SUM(Amount) Amount
    FROM
        YourTable
    GROUP BY Code, Type
    ORDER BY Code
    

提交回复
热议问题