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

Trying to join two queries without having duplicate entries

Status
Not open for further replies.

slb818

Technical User
Apr 19, 2001
2
US
I have two queries that I have created that are based off one table. One has business addresses, and one has home addresses. The contact ID field is the primary key of the table and is in both of the queries. I'm trying to build a SQL statement that pulls all the records from both queries where the contact ID is NOT equal, but I keep getting the "Enter Parameter Value" message box, and I don't know what it wants there. Anyone got any suggestions? Please?
 
It sounds like you need a Union query- what is the SQL that you have so far? The Select Distinct statement may help you aviod dups, but it's hard to tell without knowing the SQL you're using.
 
At the moment the statement I have is fairly simple:

SELECT [Qry_Business Addresses].*, [Qry_Home Addresses].*
FROM [Qry_Business Addresses], [Qry_Home Addresses]
WHERE ((([Qry_Business Addresses].[Contact ID])<>[Qry_Home Addresses].[contact ID]));

Now when I run it, it gives me output without asking for parameters, but the only entry it pulls from the 2nd query (Qry_Home Addresses) is the very first one in the list. So it's still not right. Can you help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top