We have student enrollment data in a table with a (simplified) format
of:
ID
Date
Enroll_Reason
Enroll_reason can be Start or Stop.
A student may have multiple sets (Start, Stop, Start), but will always
have at least one Start.
Example:
0001, 09-01-2007, Start
0002, 09-01-2007, Start
0002, 10-31-2007, Stop
0002, 01-01-2008, Start
0003, 11-01-2008, Start
We need to be able to pull all students with enrollments during a
specified time period using two parameters , and I am at a loss as to
how to structure the SQL. I know this will have to do a self-join, but
not to sure how to even begin to do the filter to not overlap into a
possible next start.
I hope this makes sense! Any help is greatly appreciated!
of:
ID
Date
Enroll_Reason
Enroll_reason can be Start or Stop.
A student may have multiple sets (Start, Stop, Start), but will always
have at least one Start.
Example:
0001, 09-01-2007, Start
0002, 09-01-2007, Start
0002, 10-31-2007, Stop
0002, 01-01-2008, Start
0003, 11-01-2008, Start
We need to be able to pull all students with enrollments during a
specified time period using two parameters , and I am at a loss as to
how to structure the SQL. I know this will have to do a self-join, but
not to sure how to even begin to do the filter to not overlap into a
possible next start.
I hope this makes sense! Any help is greatly appreciated!
Comment