Group by two columns and display grand total in every row

后端 未结 6 1069
太阳男子
太阳男子 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:11

    You can try this simpler solution:

    select Code,sum(ItemCount),Type,sum(Amount) from table group by code,type
    

    Understanding the 'group by' would come handy

提交回复
热议问题