Find new data in one Table

  • Thread starter Thread starter gatarossi
  • Start date Start date
G

gatarossi

Dear all,

I have two tables, the first is like a cadastre of products... the
second is the movement of stock.

I update the second table (movement of stock) with an excel sheet and
this sheet can contain some new product_code. These new codes don't
exist in the first table - cadastre of products...

How can I find the product codes that exist in the second table and
don't exist in the first table?

The two tables don't have primary key, only a relation whith the field
product_code.

Thanks a lot!!!

André.
 
Hi André

Assume first table named cadastre and second table named movement
and both have a column called product_code

Create a new query without adding any tables, go into SQL view and paste in
the following (you will need to change table and column names to match
yours)...

select movement.product_code
from movement left join cadastre
on movement.product_code = cadastre.product_code
where cadastre.product_code is null

By the way, it is good practice (some would say essential) to have a primary
key.

hth

Andy Hull
 
Back
Top