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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COMPARING TO TABLES

Status
Not open for further replies.

IFORD

Technical User
Sep 21, 2004
32
US
I have two table that have a field call name I would like to compare them to see the names that do not match up. One table has 5100 and the other table has 3100 I need the 2000 name that is in the first table and not in the other table, I have tryed unmatch query and get nothing and I have a made a sql with this in it

SELECT Query1.Expr1
FROM MAILnet INNER JOIN Query1 ON MAILnet.name = Query1.Expr1;

but I dont know how to make it not equal instead of =

Thank you for your help
 
Maybe:
Code:
SELECT Query1.Expr1 
FROM MAILnet [COLOR=blue]LEFT JOIN[/color] Query1 ON MAILnet.name = Query1.Expr1 
[COLOR=blue]WHERE (((MAILnet.name) Is Null))[/color];


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
How about:

[tt]SELECT tblA.[Name], tblB.[Name]
FROM tblA LEFT JOIN tblB ON tblA.[Name] = tblB.[Name]
WHERE tblB.[Name] Is Null[/tt]

Change tblA to the name of the table will 5100.
Change tblB to the name of the table will 3100.
 
When I change my code to yours I get no names at all and I should tell you that my query1 has 5100 names and mailnet has 3100
 
swap the table names
Code:
SELECT Query1.Expr1 
FROM [b]Query1 LEFT JOIN MAILnet[/b] ON MAILnet.name = Query1.Expr1 
WHERE (((MAILnet.name) Is Null));


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Greg, That work, but can you tell me why I'm missing 5 names instead of getting 2000 names I got 1995
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top