SELECT
a.[userId]
,a.[prodId]
,sum(a.[piece]) piece
,b.title
,b.price
,b.remark
,b.coName
,b.coId
FROM [dbo].[GOA_CustProduct_shoppingCart] a
left join [dbo].[GOA_CustProduct] b on b.[prodId]=a.[prodId]
group by a.[userId],a.[prodId],b.title,b.price,b.remark,b.coId,b.coName