I have a data base that tracks new private wells that have been drilled. We test these wells to make sure the quality of the well is ok. If the water results come back with coli, it is graded with a "P", if it is ok, it is graded with a "N". If the water is "P", then we must go back out at a later date to retest the well. I need to have a query that will generate a list for the wells that need to be retested. If on the second visit, the water is "N", then this well should not be included in the list.
With this sql:
SELECT WellSample.WellID, Last(WellSample.DateSampled) AS LastOfDateSampled, WellSample.[Coli Result], WellSample.Notes
FROM WellSample
GROUP BY WellSample.WellID, WellSample.[Coli Result], WellSample.Notes
HAVING (((WellSample.WellID)>0));
I get a list of all wells that have been tested, some have more than one test, the first being P, the second being N.
What I want the query to do is to filter out all wells that have tested N
I have tried this sql:
SELECT WellSample.WellID, Last(WellSample.DateSampled) AS LastOfDateSampled, WellSample.[Coli Result], WellSample.Notes
FROM WellSample
GROUP BY WellSample.WellID, WellSample.[Coli Result], WellSample.Notes
HAVING (((WellSample.WellID)>0) AND ((WellSample.[Coli Result])<>"N"));
This filters out all the "N" tests, but it still includes the "P" test even if a 2nd test was done and has come back ok (N).
Any help you can give will be GREATLY appreciated!
With this sql:
SELECT WellSample.WellID, Last(WellSample.DateSampled) AS LastOfDateSampled, WellSample.[Coli Result], WellSample.Notes
FROM WellSample
GROUP BY WellSample.WellID, WellSample.[Coli Result], WellSample.Notes
HAVING (((WellSample.WellID)>0));
I get a list of all wells that have been tested, some have more than one test, the first being P, the second being N.
What I want the query to do is to filter out all wells that have tested N
I have tried this sql:
SELECT WellSample.WellID, Last(WellSample.DateSampled) AS LastOfDateSampled, WellSample.[Coli Result], WellSample.Notes
FROM WellSample
GROUP BY WellSample.WellID, WellSample.[Coli Result], WellSample.Notes
HAVING (((WellSample.WellID)>0) AND ((WellSample.[Coli Result])<>"N"));
This filters out all the "N" tests, but it still includes the "P" test even if a 2nd test was done and has come back ok (N).
Any help you can give will be GREATLY appreciated!