How to compare 2 tables to update price and to find extra parts in either table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wbfuga
    New Member
    • Aug 2016
    • 2

    How to compare 2 tables to update price and to find extra parts in either table

    Table1
    Part_name
    Price

    Table2
    Part_name
    Price

    Table1 may have part numbers that are not in Table2
    Table2 may not have part numbers that are in Table1
    For the parts that are the same, I need to compare prices

    I want to return a new table that shows
    Parts in table 1 that are not in table 2
    Parts in table 2 that are not in table 1
    Prices that are not equal for matching part numbers

    These tables have matching field names, part numbers, price etc.

    Any help is appreciated, I am comparing over 1000 records
    Last edited by Wbfuga; Aug 10 '16, 11:34 PM. Reason: Typo
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    I would use a UNION query with:
    Code:
    Select part, price as price1, 0 as price2 from tblOne
    UNION
    select part, 0 as price1, price as Price2
    Next I would create a Group By query on this UNION to get the MAX() of the Price1 and Price2 field per part.
    This will give all info and allows you to exclude the rows with Price1 = Price2, thus having one table with the culprit.

    Getting the idea?

    Nic;o)

    Comment

    • Wbfuga
      New Member
      • Aug 2016
      • 2

      #3
      Not sure, I will keep trying
      thank you for the help.

      Comment

      Working...