Would like help designing a query
Posted on 2007-08-07
I am trying to write a query that will return all the packaging materials that we need to have in stock on a given date. Here is some background:
I can write a query that will return all the part numbers and quantities that are scheduled to be produced by a given date.
I can write a query that will call a function provided by our ERP supplier that will return all the packaging materials, and quantities for any given item.
The only way that I would know to provide a list of the total packaging requirements needed on a given date would be to run the first query and insert the items into a temp table, then create a loop that would run through each item in the temp table and call the function that returns the packaging material requirements for each item.
Ive got to believe that there is a better way to do this, can someone steer me in the right direction ??