SQL Server - GROUP BY on one column

后端 未结 5 1966
感情败类
感情败类 2020-12-31 04:48

I\'m trying to get orders from an orderview. In my view I do have some rows with exactly the same values, but I want to group these values on orderid and take the sum of the

5条回答
  •  温柔的废话
    2020-12-31 05:39

    I have used similar kind of table as yours. names would be different jsu to test it fast. Please refer to the following query. Modify names as you require.

    select ordid,customerid,articleid,SUM(cast(quantity as numeric)) quantity from test_stack group by ordid,customerid,articleid
    

提交回复
热议问题