I am writing a production record report and am having some difficulty. Here is what I am trying to accomplish:
Let's say I am creating a temp table with 3 columns:
Table:
#TProductionRecordscolumn #1:
Part_No- column #2:
Quantity - column #3:
Total_Quantity
Any given part may be produced multiple times on any given day, in different quantities:
row 1: part1 55 row 2: part1 105 row 3: part1 70 row 4: part2 100 row 5: part2 25 row 6: part3 150 row 7: part3 50 row 8: part3 35 row 9: part3 80 etc..
I would like the Total_Quantity column to start a running total, then reset when there is a new part. I have the select query already, but I just do not know how to add in the Total_Quantity column.
Any help would be great!
Thanks
correlated subquery...