I have the following data.
Id ParentId ProductId Quantity 215236 19297 16300319 60 215221 19297 16314611 6 215234 19297 16314670 1 <- Duplicate productid 215235 19297 16314670 2 <- Duplicate productid 215195 19297 16314697 20 215205 19297 16321820 75 215216 19297 16329252 10 215233 19297 16331834 9 215224 19297 16519280 40
Selecting unique records is easy. Or grouping the data on ProductId is also possible. I need a result that only contains a unique Product Id with the same parentid and the quantities summed up.
The result should look like this.
Id ParentId ProductId Quantity 215236 19297 16300319 60 215221 19297 16314611 6 215234 19297 16314670 3 215195 19297 16314697 20 215205 19297 16321820 75 215216 19297 16329252 10 215233 19297 16331834 9 215224 19297 16519280 40
The quantities of the duplicates
215234 19297 16314670 1 <- Duplicate productid 215235 19297 16314670 2 <- Duplicate productid
should result in
215234 19297 16314670 3