Reputation: 1
I'm having a mindblank here but my question is quick.
I have a table like the following:
Cust Part Qty Rtn Qty
Joe A1 2 0
Joe A2 3 1
Joe A1 2 2
Bob A1 3 4
Bob A2 4 0
I want the results to be like:
Joe A1 4 2
Joe A2 3 1
Bob A1 3 0
Bob A2 4 0
I'm trying to figure out how to create a sum for each customer individually according to the part?
Upvotes: 0
Views: 52
Reputation: 238196
That looks like a straightforward group by
on Cust, Part
:
select Cust
, Part
, sum(Qty)
, sum([Rtn Qty])
from YourTable
group by
Cust
, Part
Upvotes: 2