All:
I have two tables, one contains Inventory, the other Orders. The Orders are associated with a specific time period but Inventory is not. I want to join the tables and decrement Inventory from the Orders across the periods I have orders for.
Any suggestions on SQL to accomplish this would be most appreciated.
TIA,
Sven
Orders Table
Inventory Table
Needed result from join of Orders and Inventory
I have two tables, one contains Inventory, the other Orders. The Orders are associated with a specific time period but Inventory is not. I want to join the tables and decrement Inventory from the Orders across the periods I have orders for.
Any suggestions on SQL to accomplish this would be most appreciated.
TIA,
Sven
Orders Table
Code:
SKU Period Order_Qty
------ ------ ---------
A123 200803 10
A123 200804 20
A123 200807 30
B456 200804 35
B456 200807 15
B456 200808 50
C789 200803 120
Inventory Table
Code:
SKU Inv_Qty
------ ---------
A123 15
B456 75
Code:
SKU Period Order_Qty
------ ------ ---------
A123 200803 0
A123 200804 15
A123 200807 30
B456 200804 0
B456 200807 0
B456 200808 25
C789 200803 120