Query <3 years

  • Thread starter Thread starter woods1119
  • Start date Start date
W

woods1119

I am trying to query from a query to find how many people have a duration of
<3yrs.

Query#1 (qrySeen2008) has:

ingPtID
LastOfdtmVisitDate

I need to find out of these people who has a duration <3yrs. I need to use
strDoFrstSx from tPtData to do so.

So I made another query using ingPtID from qrySeen2008 and added
strDoFrstSx. I know I could just add a "Between" statement but I was
wondering if there is a way other than adding "Between 01/01/2005 and
12/31/2008". I made this in Design view but the SQL statement is below.


SELECT qrySeen2008_Last_Visit.ingPtID, tPtData.strDoFrstSx
FROM qrySeen2008_Last_Visit INNER JOIN tPtData ON
qrySeen2008_Last_Visit.ingPtID = tPtData.ingPtID
 
First problem is that you should not be using LAST. Use MAX instead. Last
gives you the value from the last record (in the group) accessed by the query.

Once you change that in your qrySeen2008, you can work on the problem.
Perhaps you can explain a bit further what you mean by "have a duration of < 3
years".

Do you mean that you want records returned if the LastofDtmVisit is less than
3 years from the current date? Or do you mean something else?

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top