G
Guest
Hi!
I have beaten my head trying to resolve this problem of deleting partly
duplicate records whose Member IDs are equal while DATE OF QUESTION are not.
member id DATE of Question Date of Action
*44 4/1/2003 4/30/2003
*44 4/2/2003 4/4/2003
*44 5/1/2003
44 5/1/2003 5/1/2003
44 5/1/2003 5/3/2003
33 3/4/2003
Earlier DATE OF QUESTION Should be deleted. However when the equal DATE
OF QUESTION remain as a subject to decide which one to take away ...then
DATA OF ACTION which is empty should be the choice
In addition , non- duplicate members (as 33) are untouchable
So I marked subject for deleing with asterisks.
The following query does the part of work
DELETE makepart1.[MEMBER ID], makepart1.[DATE OF QUESTION]
FROM makepart1
WHERE (((MAKEPART1.[Date of Question])<(select max( [Date of Question] )
from MAKEPART2 where Makepart2.[MEMBER ID]=MAKEPART1.[MEMBER ID])));
: it deletes earlier dates of DATE of QUESTION but unfortunately when there
are the SAME ID and SAME [Date of Question] …then I do not know how to delete
just the one whose [DATE OF ACTION] is null (if any). Also non-duplicates are
untouchable
When equal members (I mean equal id, DATE OF QUESTION ] and DATE OF ACTION
not null left like the followings:
member id DATE of Question Date of Action
44 5/1/2003 5/1/2003
44 5/1/2003 5/3/2003
Then I do not care which one to delete and the following query can be used
and it works.
SELECT makepart1.[MEMBER ID], Last(makepart1.[MEMBER FIRST NAME]) AS [Member
First Name_], Last(makepart1.[MEMBER LAST NAME]) AS [Member Last Name_},
makepart1.[other field] as Last(makepart1.[other field_])
FROM makepart1
GROUP BY makepart1.[MEMBER ID];
Is there any easy way to adjust my query?
Can it be done without VBA loop which I am not familiar with? I desperately
need it…
I have beaten my head trying to resolve this problem of deleting partly
duplicate records whose Member IDs are equal while DATE OF QUESTION are not.
member id DATE of Question Date of Action
*44 4/1/2003 4/30/2003
*44 4/2/2003 4/4/2003
*44 5/1/2003
44 5/1/2003 5/1/2003
44 5/1/2003 5/3/2003
33 3/4/2003
Earlier DATE OF QUESTION Should be deleted. However when the equal DATE
OF QUESTION remain as a subject to decide which one to take away ...then
DATA OF ACTION which is empty should be the choice
In addition , non- duplicate members (as 33) are untouchable
So I marked subject for deleing with asterisks.
The following query does the part of work
DELETE makepart1.[MEMBER ID], makepart1.[DATE OF QUESTION]
FROM makepart1
WHERE (((MAKEPART1.[Date of Question])<(select max( [Date of Question] )
from MAKEPART2 where Makepart2.[MEMBER ID]=MAKEPART1.[MEMBER ID])));
: it deletes earlier dates of DATE of QUESTION but unfortunately when there
are the SAME ID and SAME [Date of Question] …then I do not know how to delete
just the one whose [DATE OF ACTION] is null (if any). Also non-duplicates are
untouchable
When equal members (I mean equal id, DATE OF QUESTION ] and DATE OF ACTION
not null left like the followings:
member id DATE of Question Date of Action
44 5/1/2003 5/1/2003
44 5/1/2003 5/3/2003
Then I do not care which one to delete and the following query can be used
and it works.
SELECT makepart1.[MEMBER ID], Last(makepart1.[MEMBER FIRST NAME]) AS [Member
First Name_], Last(makepart1.[MEMBER LAST NAME]) AS [Member Last Name_},
makepart1.[other field] as Last(makepart1.[other field_])
FROM makepart1
GROUP BY makepart1.[MEMBER ID];
Is there any easy way to adjust my query?
Can it be done without VBA loop which I am not familiar with? I desperately
need it…