simple question

  • Thread starter Thread starter Caldog1557
  • Start date Start date
C

Caldog1557

Guest
This is a simple question I'm sure. I have a database with inventory items in two tables. One of the fields in each table is price. I need a query that will compare the price in both tables and return results where the price doesn't match. I only need the records where the price is different. Sounds easy unless you're me! :confused:
 
Your simply lookng to return the items with UNEQUAL (<>) prices? I would have to assume that your 2 tables share a common key or unique identifier. You would add both tables to the query with a link between the unique keys/identifiers, then add all of the fields you want to display. Then beneath the price field you can enter into the criteria field the expression that would select only those that have unequal prices.
Say you have 2 tables TBL1 and TBL2. Lets assume that they are identical except for the possiblity of certain prices.

The field in which the prices are entered is titled ItemPrice. Creat a query and add both tables. Say the true prices are in tbl2, and you are looking for the different one in tbl1. Add all of the fields from tbl1 intop the query builder then below ItemPrice you would add <>[tbl2]![ItemPrice]. Now when the query is run, it will only return the records from tbl1 that do not match the prices in tbl2. THIS IS ONLY IF YOU HAVE AN ESTABLISHED LINK BETWEEN THE TWO TABLES. By stating that they are identical tables in my earlier remarks, this would indicate the same primary key field. Take a peek at the example I posted and let me know what you think.
 

Attachments

Jeremie,
Works perfectly. Thanks very much.

jeremie_ingram said:
Your simply lookng to return the items with UNEQUAL (<>) prices? I would have to assume that your 2 tables share a common key or unique identifier. You would add both tables to the query with a link between the unique keys/identifiers, then add all of the fields you want to display. Then beneath the price field you can enter into the criteria field the expression that would select only those that have unequal prices.
Say you have 2 tables TBL1 and TBL2. Lets assume that they are identical except for the possiblity of certain prices.

The field in which the prices are entered is titled ItemPrice. Creat a query and add both tables. Say the true prices are in tbl2, and you are looking for the different one in tbl1. Add all of the fields from tbl1 intop the query builder then below ItemPrice you would add <>[tbl2]![ItemPrice]. Now when the query is run, it will only return the records from tbl1 that do not match the prices in tbl2. THIS IS ONLY IF YOU HAVE AN ESTABLISHED LINK BETWEEN THE TWO TABLES. By stating that they are identical tables in my earlier remarks, this would indicate the same primary key field. Take a peek at the example I posted and let me know what you think.
 

Users who are viewing this thread

Back
Top Bottom