I have many suppliers for many products. I want to get a total quantity for each product (stock from all suppliers). This bit is pretty simple!
The problem is, two of the suppliers are actually the same. In the below example, it's A and B. There isn't duplication for every product, they sell different items but occasionally cross over. When they DO cross over, I don't want to count that stock twice.
I don't need to keep any specific supplier info for this exercise. So removing supplier B where supplier A already exists for that product would work. I just can't figure out how to do it! A query? Programmatically?
supplier productID quantity
A 1 92
B 1 92
C 1 10
D 2 2
B 2 16
Required output
productID SumOfQuantity
1 102
2 18
The problem is, two of the suppliers are actually the same. In the below example, it's A and B. There isn't duplication for every product, they sell different items but occasionally cross over. When they DO cross over, I don't want to count that stock twice.
I don't need to keep any specific supplier info for this exercise. So removing supplier B where supplier A already exists for that product would work. I just can't figure out how to do it! A query? Programmatically?
supplier productID quantity
A 1 92
B 1 92
C 1 10
D 2 2
B 2 16
Required output
productID SumOfQuantity
1 102
2 18