Hi,
I used the query wizard to create a duplicates query on one table. The query seems to work as expected.
But much of the data in the main table is mostly normalized, i.e., many fields are filled with numbers relating to other tables where the texts reside.
Because I wanted to get this info to the person responsible for making the corrections, I wanted to link the 'text' tables to the main table and show the text associated with a given field instead of a number.
When I did this and ran the query, I got fewer records than with the original query. Also, several of the records in the modified query showed only one record with the field that was supposed to contain the duplicated records.
I'm a bit confused as to why this should happen since I selected only one field that might contain duplicated data.
Here are the SQL codes for each query. The first is based solely on the main table (Members). The second links some of the numbered fields with their associated 'text' tables in order to show text instead of numbers.
This query returns 147 records; most Card Numbers have 2 records duplicated; one has 3 dups and one has 4 dups.
Here's the design mode for the above query:
This query returns 139 records. Now 8 records don't show their respective duplicates.
And here's the design mode for the other query:
I don't understand why there is this discrepancy. I lost 8 records in the second query.
Any suggestions?
Thanks,
Vic
I used the query wizard to create a duplicates query on one table. The query seems to work as expected.
But much of the data in the main table is mostly normalized, i.e., many fields are filled with numbers relating to other tables where the texts reside.
Because I wanted to get this info to the person responsible for making the corrections, I wanted to link the 'text' tables to the main table and show the text associated with a given field instead of a number.
When I did this and ran the query, I got fewer records than with the original query. Also, several of the records in the modified query showed only one record with the field that was supposed to contain the duplicated records.
I'm a bit confused as to why this should happen since I selected only one field that might contain duplicated data.
Here are the SQL codes for each query. The first is based solely on the main table (Members). The second links some of the numbered fields with their associated 'text' tables in order to show text instead of numbers.
This query returns 147 records; most Card Numbers have 2 records duplicated; one has 3 dups and one has 4 dups.
Code:
SELECT tblMembers.MemCardNo, tblMembers.MemEmpID, tblMembers.MemLName, tblMembers.MemFName, tblMembers.MemAddress1,
tblMembers.MemAddress2, tblMembers.MemCity, tblMembers.MemST, tblMembers.MemZipcode, tblMembers.MemSSNo, tblMembers.MemSex,
tblMembers.MemDOB, tblMembers.MemMemberTypeID, tblMembers.MemJoinedUnion, tblMembers.MemJoinedCompany, tblMembers.MemEffective,
tblMembers.MemStatusID, tblMembers.MemJobID, tblMembers.MemSeniority, tblMembers.MemClassID, tblMembers.MemLocation,
tblMembers.MemDivision, tblMembers.Mem_UnitNo, tblMembers.MemEmp, tblMembers.MemCounty, tblMembers.HideRec
FROM tblMembers
WHERE (((tblMembers.MemCardNo) In (SELECT [MemCardNo] FROM [tblMembers] As Tmp GROUP BY [MemCardNo] HAVING Count(*)>1 )))
ORDER BY tblMembers.MemCardNo;
This query returns 139 records. Now 8 records don't show their respective duplicates.
Code:
SELECT tblMembers.[MemCardNo], tblMembers.[MemEmpID], tblMembers.[MemLName], tblMembers.[MemFName], tblMembers.[MemAddress1],
tblMembers.[MemAddress2], tblMembers.[MemCity], tblMembers.[MemST], tblMembers.[MemZipcode], tblMembers.[MemSSNo], tblMembers.[MemSex],
tblMembers.[MemDOB], tblMembers.[MemMemberTypeID], tblMembers.[MemJoinedUnion], tblMembers.[MemJoinedCompany],
tblMembers.[MemEffective], tblStatus.fldStatus, tblJobs.fldTitle, tblMembers.[MemSeniority], tblEmployeeClass.fldClass,
tblMembers.[MemLocation], tblMembers.[MemDivision], tblMembers.[Mem_UnitNo], tblEmployers.emp_code, tblMembers.MemCounty,
tblMembers.[HideRec]
FROM tblJobs INNER JOIN (tblEmployeeClass INNER JOIN (tblStatus INNER JOIN (tblEmployers INNER JOIN tblMembers ON
tblEmployers.comp_ID = tblMembers.MemEmp) ON tblStatus.fldStatusID = tblMembers.MemStatusID) ON
tblEmployeeClass.fldClassID = tblMembers.MemClassID) ON tblJobs.fldJobID = tblMembers.MemJobID
WHERE (((tblMembers.[MemCardNo]) In (SELECT [MemCardNo] FROM [tblMembers] As Tmp GROUP BY [MemCardNo] HAVING Count(*)>1 )))
ORDER BY tblMembers.[MemCardNo];
And here's the design mode for the other query:
I don't understand why there is this discrepancy. I lost 8 records in the second query.
Any suggestions?
Thanks,
Vic