Finding consecutive dates when dates are not truly consecutive



Hello,

I'm trying to do this in ASE via a straigth SELECT, but I could create
stored procedures if necessary. Here's my SQL problem. I'm trying to
find N consecutive absences for students where the dates are from a
school calendar which excludes weekends (meaning the dates are not
necessarily fully consecutive).

SCHOOL_CALENDAR
INSESSION_DAY
------------
8/25/04
8/26/04
8/27/04
8/30/04
8/31/04


STUDENT_ABSENCES
STUDENTID ABSENCE_DATE
--------------------------
1 8/25/04
1 8/26/04
1 8/31/04
2 8/26/04
2 8/27/04
2 8/30/04
3 8/25/04
3 8/27/04
3 8/31/04

If I query for students with 3 or more consecutive absences, my query
or stored procedure needs to return STUDENTID = 2. Note that even
though this student's dates are not consecutive dates in the strict
sense, they are consecutive according to the school calendar.

Thanks in advance for any help.

Onassis

.



Relevant Pages

  • How do I do Paging through a large dataset via Stored Procedures
    ... Paging by dynamically altering the SQL Query ... Create stored procedures ... SELECT * FROM STUDENTS ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Using a subform to display and add info into table
    ... - Did you create a query by cutting & pasting the INSERT SQL statement into ... - With the Attendance form open, with a SessionID and SessionDate entered, ... >> Each instance will have many students, and, in fact, the same students that ... >> a combo box for the SessionID (with the same properties as the one on your ...
    (microsoft.public.access.forms)
  • RE: Access chart reports
    ... I would use the union query to create a chart on a form or report. ... FROM Students ... SELECT UniqueID, "AggressionPhysicalPresent" ...
    (microsoft.public.access.reports)
  • RE: Access chart reports
    ... I have finished the query now, thanks so much, except I still need to know ... FROM Students ... SELECT UniqueID, "AggressionPhysicalPresent" ... 57 AggressionPhysicalPresent behaviours. ...
    (microsoft.public.access.reports)
  • RE: Access chart reports
    ... Right I will try that then, where do I say in the union query true or false? ... FROM Students ... SELECT UniqueID, [AggressionVerbalPresent] as IsPresent, ...
    (microsoft.public.access.reports)