Find new data in one Table

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é.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top