Hi-I am a newbie to SQL, so please bear with me. I am trying to run a SQL server statement which will match DB1 against DB2 finding only the NON MATCHES between the two (and writing to a third DB).
DB1 has azpprox 600,000 rows in it, DB2 has 160,000 rows.
This is code I am using, but it is only finding 1 non match (and writes a NULL row in 3rd DB).
See what you think:
SELECT DISTINCT FIN.NAME, FIN.ADDRESS, FIN.CITY,
FIN.STATE, FIN.ZIP, FIN.ZIP4, FIN.DATEOFBIRTH,
FIN.SEX, FIN.SID
into SOS_41_RERUN
FROM SOS_TABLE KEYN left outer join FINAL_FILE FIN
on FIN.SID = KEYN.SID
WHERE FIN.SID is null;
I truly appreciate your help!!
GCM
Government Coder Mark
DB1 has azpprox 600,000 rows in it, DB2 has 160,000 rows.
This is code I am using, but it is only finding 1 non match (and writes a NULL row in 3rd DB).
See what you think:
SELECT DISTINCT FIN.NAME, FIN.ADDRESS, FIN.CITY,
FIN.STATE, FIN.ZIP, FIN.ZIP4, FIN.DATEOFBIRTH,
FIN.SEX, FIN.SID
into SOS_41_RERUN
FROM SOS_TABLE KEYN left outer join FINAL_FILE FIN
on FIN.SID = KEYN.SID
WHERE FIN.SID is null;
I truly appreciate your help!!
GCM
Government Coder Mark