Compare 2 tables

From: <coral.ressources_at_gmail.com>
Date: Sun, 8 Mar 2009 10:16:27 -0700 (PDT)
Message-ID: <dbabf407-b34b-4306-94a2-7ea776896761_at_t3g2000yqa.googlegroups.com>



I have 2 tables: Input and Output.
Input table stores records in this manner: recno, prod_first, prod_span, prod_last
1, 1, 1000, 1000
2, 1001, 700, 1700
3, 1701, 100, 1800

...and so on
prod_first is the id of the product,
prod_span is the number of products stored by recno,
prod_last is the last product stored by recno

Output tables stores records related to outgoings: recno, prod_first, prod_span, prod_last

1, 500, 25, 525
2, 300, 100, 400
3, 1243, 100, 1343

That mean productss no from 500 to 525, 300 to 400 and 1243 to 1343 were delivered, while the rest from input table are still in stock. Question: how to find what is [still] in input table and not [yet] in output table?
prod_first to prod_last are the items to be found in both tables. I tought like this:
1. make 2 temp tables: input_temp, output_temp where i would insert all records [one-by-one] since in original tables i have only start & end.
2. make a comparison between the 2 temp tables (using SQL aggregation) I am concerned that step 1 would hit the db performance as i have for input table aprox 100 000 [and growing!] records to insert. Received on Sun Mar 08 2009 - 12:16:27 CDT

Original text of this message