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

Query of a Query

Status
Not open for further replies.

CTR

Technical User
Nov 15, 2001
42
US
I have two tables. The first table has many records - about 17,000 and is called bbdd. The second table (DupCheck) is related to the first and contains records that have been compared to records in the first table and found not to be the same. What I want to do is look for duplicate records, then query that query with a comparison to the records that have benn checked and found OK.

Here is the first query (called bbddquery) to check for duplicates, it works great as is in Access:

SELECT DISTINCTROW Bbdd.[First Name], Bbdd.[Last Name], Bbdd.Number, Bbdd.[Middle Name], Bbdd.DonorID, Bbdd.DOB, Bbdd.SSN, Bbdd.[ABO/RH], Bbdd.NMB, Bbdd.[Addr Line 1], Bbdd.[Addr Line 2], Bbdd.[Addr Line 3], Bbdd.[Addr Line 4], Bbdd.Zip, Bbdd.[Home Phone], Bbdd.[Work Phone]
FROM Bbdd
WHERE (((Bbdd.[First Name]) In (SELECT [First Name] FROM [Bbdd] As Tmp GROUP BY [First Name],[Last Name] HAVING Count(*)>1 And [Last Name] = [Bbdd].[Last Name])))
ORDER BY Bbdd.[First Name], Bbdd.[Last Name];


Here is my attempt at the second query. It isn't working as planned, regardless of the records entered, it produces the same records as the first query.

SELECT Distinct Bbdd.[First Name], Bbdd.[Last Name], Bbdd.Number, Bbdd.[Middle Name], Bbdd.DonorID, Bbdd.DOB, Bbdd.SSN, Bbdd.[ABO/RH], Bbdd.NMB, Bbdd.[Addr Line 1], Bbdd.[Addr Line 2], Bbdd.[Addr Line 3], Bbdd.[Addr Line 4], Bbdd.Zip, Bbdd.[Home Phone], Bbdd.[Work Phone]
FROM Bbddquery
LEFT JOIN DupCheck ON Bbddquery.DonorID <> DupCheck.donorID
ORDER BY Bbddquery.[last Name], Bbddquery.[first Name];


Any tips? _____________

Cliff
 
Anyone have a thought on this? _____________

Cliff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top