unmatched query

R

rneaul

I have two tables with approx 200 fields and 300 records each. One table is
older than the other. I would like to compare all 200 fields and create a
new table of only those items that have changed. I know I can write a
separate query for each field, but am hoping there is a way to only write
one. Does anyone have any ideas?

Thanks
 
M

Michel Walsh

Hi,


If you have a primary key that didn't changed, it can be something like:

SELECT a.*, b.pk
FROM a LEFT JOIN b ON a.pk=b.pk
WHERE b.pk IS NULL
OR a.f1 <> b.f1
OR a.f2 <> b.f2
OR ...
OR a.200 <> b.200



Note that you can't get more than 255 fields.




Hoping it may help,
Vanderghast, Access MVP
 

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