CASE statement or LOOP statement that find unduplicated new entries for the year
Posted on 2013-06-11
I have a table named tblAttendance in SQL 2008 that has a listing of all students and their hours. I would like to make a CASE statement where I can find all the unduplicated records that entered hours for the first time each month of our fiscal year.
Using the following fiscal month pattern order starting with June, I would like to find an unduplicated recordcount of all records that have a total > 0 for the first time.
For example, if two students have entered hours for the first time in JULY, then the total for that month would be 2, since there are two records that have a total > 0
But once they are counted they would not be counted in all the months after. Hence the totals for each month would be unduplicated.