Hi Guys,
I have two tables and I want to write a query that will list all the records that are in my 1099_PER table, but do not exist in the original table. The original has about 18,100 records while the 1099_PER table has about 18,430.
I wrote this query:
It only gave me 68 records which concerned me because there is like a 300 count difference between the two tables. However, I discovered the source of the problem. I am doing a comparison on the SSN and both tables may contain the same SSN, but the larger table contains multiple records of the SSN. I found one SSN that had four records in the 1099 table, but only two records in the original. Even worse, these records are not duplicates. Each record has a different dollar amount.
So I need to find some way to compare the tables and account for multiple instances of the same SSN. If one table contains 4 records of the same SSN, and the other one only has two then I want my query to list the two records missing from the original. IS there any way to do this??
I have two tables and I want to write a query that will list all the records that are in my 1099_PER table, but do not exist in the original table. The original has about 18,100 records while the 1099_PER table has about 18,430.
I wrote this query:
Code:
SELECT A.SSN, A.Name4
FROM [1099_PER] A
LEFT OUTER JOIN original B ON A.SSN=B.SSN
where B.SSN is NULL
It only gave me 68 records which concerned me because there is like a 300 count difference between the two tables. However, I discovered the source of the problem. I am doing a comparison on the SSN and both tables may contain the same SSN, but the larger table contains multiple records of the SSN. I found one SSN that had four records in the 1099 table, but only two records in the original. Even worse, these records are not duplicates. Each record has a different dollar amount.
So I need to find some way to compare the tables and account for multiple instances of the same SSN. If one table contains 4 records of the same SSN, and the other one only has two then I want my query to list the two records missing from the original. IS there any way to do this??