Duplicate Query Mess II

G

Guest

I posted this question a few days ago and received a partial answer, but the
thread seems to have died and I still have a peoblem.

Here's the code and the problem now is:

If there is a "Jim Shoe" in the "HuskyTemp" table and a duplicate (2
records) of "Jim Shoe" in the "NAMES" table, the 2 records from the "NAMES"
table will be written to the "DupeHusky" table.
BUT
If there is a "Jim Shoe" record in the "HuskyTemp" table and a duplicate
"Jim Shoe" record in the "NAMES" table it is _not_ written in the "DupeHusky"
table like it should be.

SELECT NAMES.LNAME, NAMES.FNAME, NAMES.ADD1, NAMES.EMAIL, NAMES.ID,
NAMES.ENTRYDATE INTO DupeHusky
FROM [NAMES] INNER JOIN HuskyTemp ON (NAMES.EMAIL = HuskyTemp.Email) AND
(NAMES.ADD1 = HuskyTemp.ADD1) AND (NAMES.LNAME = HuskyTemp.LNAME) AND
(NAMES.FNAME = HuskyTemp.FNAME)
WHERE (((NAMES.LNAME) In (SELECT [LNAME] FROM [NAMES] As Tmp GROUP BY
[LNAME],[ADD1] HAVING Count(*)>1 And [ADD1] = [NAMES].[ADD1])) AND
((NAMES.FNAME) In (SELECT [FNAME] FROM [NAMES] As Tmp GROUP BY [FNAME],[ADD1]
HAVING Count(*)>1 And [ADD1] = [NAMES].[ADD1])))
ORDER BY NAMES.LNAME, NAMES.ADD1;


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top