SQL to determine if a non-attendance is a "DROPOUT"

I have the following attendance table

Current Attendance Table

and need to have it changed as follows with reasons attached:

New Status as it needs to be

I’ve tried using SQL that check for “Streaks” checking for months with Combined Attendances but cannot get the “Dropped out from” to be correct. Any help will be highly appreciated.

Source: sql

Leave a Reply