Group by two columns and display grand total in every row

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

    You can try this query:

    SELECT Code,SUM(ItemCount) AS ItemCount,Type,SUM(Amount) AS Amount
    FROM
        table
    GROUP BY Code, Type
    

    This will give you proper result. You need to group by Code and Type and not ItemCount

提交回复
热议问题