我有这样的结果 Current output 我理解Group by并使用Sum来得到价格总结但是如何通过逗号分隔将所有组中的部件号组合在一起?
答案 0 :(得分:1)
您需要添加listagg函数,以便通过值获取该组的逗号值。
Select Quote_number
,Customer
,Customer_no
,Address
,Other_infor
,Sum(Price), LISTAGG(Part_number, ', ')
From table
Group By Quote_number
,Customer
,Customer_no
,Address
,Other_infor
答案 1 :(得分:0)
简而言之,您需要按照您未聚合的所有内容进行分组。
Select [Quote number]
,[Part number]
,[Customer]
,[Customer no]
,[Address]
,[Other infor]
,Sum([Price])
From table
Group By [Quote number]
,[Part number]
,[Customer]
,[Customer no]
,[Address]
,[Other infor]