Tracking differences between tables

D

DevilDog1978

I have two tables [pcinventry unedited] and [pcinventrySQL] I want to compare
the differences in the fields model, fscm, nomen, and std_cal. Both tables
use ecn as a common unique field. I would like to be able to generate
individual reports highlighting the differences based on sub_cust (via a
dropdown if possible). Any clue on how to go about doing this?
 
F

Fred

To start withy you will want to think through and define exactly what you
want to see. I.E. exactly what would it show and under what conditions.

Then create a query which joins the two tables, PK to PK, and which
implements your answer(s) from the previous paragraph.

For example, If the Field1 in Table A doesn't match Field1 in Table B,show
/ list the contents of those two fields pllus the PK value.
 
P

Pieter Wijnen

to get you started:
SELECT A.* FROM A
WHERE NOT EXISTS (SELECT 'X' FROM TABLE B
WHERE B.F1 = A.F1 OR B.F2 = A.F2)
UNION ALL
SELECT B.* FROM B
WHERE NOT EXISTS (SELECT 'X' FROM TABLE A
WHERE B.F1 = A.F1 OR B.F2 = A.F2)

hth
Pieter
 

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