ChrisM@Work (4/3/2013)
Does it meet the requirements for Step 1? The accumulation would be Step 2.
I'm going to say no it doesn't meet the requirements for Step 1 and here's why.
If an ID missed 15 periods in Term 1 and missed One period in Term 2. The results of your query would be:
Term 1 Missed = 1
Term 2 Missed = 0
Total(accumulation) = 1
when it should be:
Term 1 Missed = 1
Term 2 Missed = 2 (accumulated days missed from first day of school thru the end of Term 2)
Also, ID 717 missed One prior to Term 4 starting and the results of your query is Zero, so an accumulation for 717 would be Zero when it should be One.
I would think that instead of calculating a suitable term start date (StartDate in your query), I just pass it the first day of school this would work all in One Step. If the StartDate is the same date for the calculation of a Term then we get the accumulation, correct?
Your query produced the following results:
SchoolYRIDLocIDTestNameTermDaysMissedScoreStartDateEndDateMissed
2012-2013414355 CSA 1-21021.00NULL2012-10-120
2012-2013414355 CSA 2-22023.002012-10-132012-12-201
2012-2013414355 CSA 3-13016.002012-12-212013-03-071
2012-2013414355 CSA 4-14016.002013-03-082013-05-240
2012-2013414355 CSA 4-24023.002013-03-082013-05-240
But what if the StartDate for ALL results was 2012-08-14? Wouldn't that get the correct #'s for each Term?
Or do I not even come close to understanding your query?