select count(1) FROM sms_mdm_detail st, schools s, report_blockwise b where st.sms_code=\'ATTD\' AND st.date BETWEEN @start_date AND @end_date and st.school_code=s.school_co