Max and Min of dates - please help!

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi Everyone,

I have a file with a customer ID, and then a visit date
field, this is linked to a primary table with
demographics on. On the table I'm working on a person can
have had several visits dates in the one visit column. I
can do a query with the MIN date of someones visit and
their MAX to get their latest visit, i can then put the
data into excel to work out time intervals...but how do I
select the visits in between to work out the intervals
e.g.

custid visit
xxxx date1 MIN
xxxx date2
xxxx date3
xxxx date3
xxxx date4
xxxx date5 MAX

Why can't I do a query where I can get selct cust id and
calculate the intervals in a Group By

xxxx AND MAX([VISIT])-MIN9[VISIT])

is ther some other way to do this. really need help with
this so would be greatful for any feedback!

Cheers

Daniel
 
Daniel,

Either I have misunderstood the question, or, what you say doesn't work
is working ok for me. SQL of such a query might look something like this...

SELECT custid, Max([visit])-Min([visit]) AS Interval
FROM YourTable
GROUP BY custid
 
Back
Top