Create table by comparising 2 tables

5 pts.
Tags:
Access conditional expressions
CREATE TABLE statement
Database programming
Microsoft Access
I am new at Access but have some help with creating a db. I would like to know if it is possible to compare table 1: prior data and table 2: current data, and then create a table 3, with all the changes/deletions from the 1st table to the 2nd. All the data is workflow tasks that are dates. I need a new table that will show all the updated dates, new dates, and removed dates. is that possible?
ASKED: November 6, 2008  4:38 AM
UPDATED: November 6, 2008  3:08 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Using SQL, you could write a query to get the differences between table1 and table2.

I don’t remember the access syntax, so please make the necessary corrections.

It could be something like this:

<pre>select table2.*, ‘CHANGED’ as status
from table1, table2
<JOIN CONDITIONS>
where table1.field1 != table2.field1
or table1.field2 != table2 != field2
<or …>
UNION
select table2.*, ‘ADDED’ as status
from table2
where <primary key fields> not in
(select <primary key fields>
from table1)
UNION
select table1.*, ‘DELETED’ as status
from table1
where <primary key fields> not in
(select <primary key fields>
from table2)</pre>

You could create a new table from the result of this query.
In access I think (but not sure) this can be achieved this way:

SELECT * INTO [NEW_TABLE]
FROM …

Hope this helps.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following