TallGuyinIT
IS-IT--Management
New to SQL and I am really struggling with some of the concepts. I am trying to calculate how many orders have inventory available. I have 2 temp tables;
table 1 has columns - order#, SKU, qty ordered, qty available.
table 2 has columns - SKU, qty on hand
I am trying to write a loop that will scroll through table #1 one record at a time and update qty available with qty ordered or 0 based on table #2 qty on hand. After determining the qty available, that number needs to be subtracted from qty on hand in table #2 so that inventory is not over committed.
I have searched this forum and googled updating 2 tables simultaneously to no avail. Can anyone offer some help?
Thank you
table 1 has columns - order#, SKU, qty ordered, qty available.
table 2 has columns - SKU, qty on hand
I am trying to write a loop that will scroll through table #1 one record at a time and update qty available with qty ordered or 0 based on table #2 qty on hand. After determining the qty available, that number needs to be subtracted from qty on hand in table #2 so that inventory is not over committed.
I have searched this forum and googled updating 2 tables simultaneously to no avail. Can anyone offer some help?
Thank you