Snufse:
You did not state what you want to do with the comparisons of Table 1 and Table 2. Are you wanting to identify the costcenters of Table 2 that are without the CostCodeType? or what?
My response is based on Table1 and Table2 only and performed outside of your listed code.
PASS1: Build a QUERY of Table 2 that combines the CostCenters and CostCenterType. Save NewTable2.
PASS2: Build a QUERY of Table 1 that extracts only one occurence of CostCenter. This could be a little tricky and you may have to include region or location code, but that is up to you and your application. This response is thinking the CostCenter is enough. To build a new Table1 use: SELECT DISTINCT CostCenter. SaveAs NewTable1
PASS3: This PASS is the Comparison of NewTable1 and NewTable2, which you save as CompareCostTbl. Use the LEFT JOIN in the SELECT Statement. This will compare the two tables and will produce or list every entry or value in NewTable1 and Matches and Nomatches of NewTable2. The NoMatches will be "Blank" and all saved in the CompareCostTbl.
PASS4: This Pass is left up to you as what you want to do with either the CostCenter Matches of CostCenter Non-Matches or both.
However, I strongly suggest and recommend NOT to do the above in one Pass, it can really "hang" the system.
Hope this Helps.
__________________
Disclaimer: The above comments are solely the opinion of one person and not to be construed as a directive or an incentive to commit fraudulent acts.
|