Comparison Query

  • Thread starter Jamie Harbour via AccessMonster.com
  • Start date
J

Jamie Harbour via AccessMonster.com

Hello

I have a table of staff information and i recieve a new feed every week, i
keep the previous list as a backup and then import the new feed. I would like
a comparison that shows me the old record and the new record to show changes.
Each person has a unique identifier, any ideas?

Thanks

Jamie
 
M

Michel Walsh

Hi,



SELECT a.id, a.data, b.data, a.data-b.data as change
FROM newTable As a LEFT JOIN oldTable as b
ON a.id = b.id


should do

For a new id, the change will be NULL.



Hoping it may help,
Vanderghast, Access MVP
 
J

Jamie Harbour via AccessMonster.com

Michael,

Not sure what i am meant to change in this statment, could you please help?
 
M

Michel Walsh

Hi,

You supply the real name for oldTable and newTable, which, I assumed, hold
the old data and the new data.

I also assumed the relevant fields were id and data. Id can be change for
the "unique identifier" you mentioned. As for the field data, that should be
the field name that has the value for which you want to get the "change".

a and b are just alias... they are shorter (to type) than the real table
names they are alias-ing. Just a time saver, and a shorter SQL statement, in
the end. change is also an alias for the computed expression.

All cap words are keywords to type as they are.


Is this in the spirit of your question?



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

Similar Threads

Comparison Query 4
I'm out of ideas. Help please 1
Append Query Issue 0
Funky Query Question 1
Query result to text field 1
Date Comparison Query 6
Balance Comparison Query 2
Make Table query 2

Top