Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Infinite Loop

Status
Not open for further replies.

memkam

Technical User
Aug 3, 2004
40
US
I have two tables, and what I want to do is find the matching records and find the records that don't match.

For instance, I want to know what records are in Table A but not in Table B and vice versa.

My code looks like this but it is giving me more than 3 mil. records. I think for every entry that doesn't match it is listing all the numbers. Please HELP!!


SELECT IIf(([A].[Service Number]<>.[Service Number]),([A].[Service Number]),0) AS CommonNumber
FROM A, B;
 
Something like this ?
SELECT A.* FROM A LEFT JOIN B ON A.[Service Number]=B.[Service Number]
WHERE B.[Service Number] Is Null;
And the same interverting A and B to get the records of B without correspondance in A.


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV, let me try this.

How you been by the way? Hope you not upset at me.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top