compare table query

zhuanyi

Registered User.
Local time
Today, 02:04
Joined
Apr 24, 2007
Messages
66
Hello,
I am just wondering whether there is any query I could use to compare the data on, say, whether all data in Table A are in Table B although some records in Table B may not be in Table A and give me the record that is in Table A but not in Table B.

Thanks!
 
PK1 is the tables primary key that would tie to the other tables primary key
Try This;

SELECT TA.PK1 , "Matched" as Rmks FROM TableA TA INNER JOIN TableB TB on TA.PK1 = TB.PK1
UNION ALL
SELECT TA.PK1 , "Not on Table B" FROM TableA TA LEFT JOIN TableB TB on TA.PK1 = TB.PK1 WHERE TB.PK1 IS NULL
UNION ALL
SELECT TB.PK1 , "Not on Table A" FROM TableB TB LEFT JOIN TableA TA on TA.PK1 = TB.PK1 WHERE TA.PK1 IS NULL
 
thx, reputation added, problem resolved
 
Hi,

I have been trying to calculate Percentile through Access 2003. Do we have a code that needs to be added. If yes, can someone provide me the code.

Thx
 
Re: compare multiple original records agains multiple records

I have several thousand records showing multiple server names, a schedule date, schedule time and a status. There will always be two records for each server, but there are often several records for each server. I need to compare these records against data I pull on a daily basis. I am trying to find out what has changed against the original set. Is there any routine way I can generate some sort of report or export showing what has changed from the original set of records for a particular server?
 

Users who are viewing this thread

Back
Top Bottom