How to Identify Subsequent Dates from a first Date?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • evilbungle
    New Member
    • Apr 2008
    • 26

    How to Identify Subsequent Dates from a first Date?

    Good Morning,

    I am struggling with something I am sure should be easy but I just can't find a good way to deal with it. I have a table which lists appointments.

    There is a CaseID, An Appointment Date and an Appointment ID (Other fields as well but these are the identifyers.) what I need to do is to run a report showing how many subsequent visits have been made. (A subsequent visit is any visit other than the first by CaseID)

    So far I have "SELECT CaseID, Min(Appointment Date]) FROM tbl_Appointment s" this brings up the first appointment for each case, the problem is I want to also bring up the Appointment Number (So that in the next query I can use "Not IN (Select ApptNbr FROM qry_FirstAppt)" as the criteria for my second visits query but if I add the Appointment Number it groups by it and therefore returns each record.

    I am sure there must be an easier way but at the moment I just can't get my head around it. Sorry if this is quite garbled but I have been trying what I thought would be a 10 minute query for two days now and it is hurting my head.
  • evilbungle
    New Member
    • Apr 2008
    • 26

    #2
    I have found the answer now thanks to this reply on another board (Typical I find it half an hour after I gave up looking!)



    Turns out the Answer is all to do with sub queries.

    Thanks for looking at my question anyway.

    Comment

    Working...