Hello,
I had previously asked a question in how to filter records based on date and was able to get it to work. However, it now leaves some groups with only one member, and I don't want to include groups of less than 1. I've tried using count, but can't seem to get it working.
The field that the groups are based on is numerical (SM24_No)
Here is the code that I'm using now to filter for the date
SELECT ENTRYTABLE.SM24_No, ENTRYTABLE.KEY, ENTRYTABLE.iPHIS_NO, ENTRYTABLE.RECDATE, ENTRYTABLE.FirstName, ENTRYTABLE.Surname, ENTRYTABLE.PatientCity, ENTRYTABLE.DOB, ENTRYTABLE.HEALTHCARD_No, ENTRYTABLE.OctalCode, ENTRYTABLE.Region_Designation, ENTRYTABLE.Strain, ENTRYTABLE.MIRU_24, ENTRYTABLE.SM24Date
FROM ENTRYTABLE
WHERE (((ENTRYTABLE.SM24_No)=True) AND ((ENTRYTABLE.RECDATE)>DateAdd("yyyy",-2,Date())))
GROUP BY ENTRYTABLE.SM24_No, ENTRYTABLE.KEY, ENTRYTABLE.iPHIS_NO, ENTRYTABLE.RECDATE, ENTRYTABLE.FirstName, ENTRYTABLE.Surname, ENTRYTABLE.PatientCity, ENTRYTABLE.DOB, ENTRYTABLE.HEALTHCARD_No, ENTRYTABLE.OctalCode, ENTRYTABLE.Region_Designation, ENTRYTABLE.Strain, ENTRYTABLE.MIRU_24, ENTRYTABLE.SM24Date;
The output (minus some fields) looks something like this.
*The last group SM24-4 is what I would like to eliminate.
SM24_No RECDATE FirstName Surname Key
SM24-2 2009-01-03 Bob Smith 001
SM24-2 2009-06-24 Carol Rae 002
SM24-3 2007-01-16 John Doe 156
SM24-3 2008-10-14 Billy Bob 346
SM24-3 2009-12-06 Jane Doe 198
SM24-4 2008-01-25 Jarod Rod 468
Thanks so much in advance
I had previously asked a question in how to filter records based on date and was able to get it to work. However, it now leaves some groups with only one member, and I don't want to include groups of less than 1. I've tried using count, but can't seem to get it working.
The field that the groups are based on is numerical (SM24_No)
Here is the code that I'm using now to filter for the date
SELECT ENTRYTABLE.SM24_No, ENTRYTABLE.KEY, ENTRYTABLE.iPHIS_NO, ENTRYTABLE.RECDATE, ENTRYTABLE.FirstName, ENTRYTABLE.Surname, ENTRYTABLE.PatientCity, ENTRYTABLE.DOB, ENTRYTABLE.HEALTHCARD_No, ENTRYTABLE.OctalCode, ENTRYTABLE.Region_Designation, ENTRYTABLE.Strain, ENTRYTABLE.MIRU_24, ENTRYTABLE.SM24Date
FROM ENTRYTABLE
WHERE (((ENTRYTABLE.SM24_No)=True) AND ((ENTRYTABLE.RECDATE)>DateAdd("yyyy",-2,Date())))
GROUP BY ENTRYTABLE.SM24_No, ENTRYTABLE.KEY, ENTRYTABLE.iPHIS_NO, ENTRYTABLE.RECDATE, ENTRYTABLE.FirstName, ENTRYTABLE.Surname, ENTRYTABLE.PatientCity, ENTRYTABLE.DOB, ENTRYTABLE.HEALTHCARD_No, ENTRYTABLE.OctalCode, ENTRYTABLE.Region_Designation, ENTRYTABLE.Strain, ENTRYTABLE.MIRU_24, ENTRYTABLE.SM24Date;
The output (minus some fields) looks something like this.
*The last group SM24-4 is what I would like to eliminate.
SM24_No RECDATE FirstName Surname Key
SM24-2 2009-01-03 Bob Smith 001
SM24-2 2009-06-24 Carol Rae 002
SM24-3 2007-01-16 John Doe 156
SM24-3 2008-10-14 Billy Bob 346
SM24-3 2009-12-06 Jane Doe 198
SM24-4 2008-01-25 Jarod Rod 468
Thanks so much in advance