A small demonstration was created for this issue.
Based on snapshots of your database

Example table schema, data, and query
create table `test` ( `id` int(11), `schoolid` int(11), `classroomid` int(11), `studentname` varchar(40), `startmonth` int(2) unsigned zerofill, `startyear` year, `endmonth` int(2) unsigned zerofill, `endyear` year); insert into `test` ( `id`, `schoolid`, `classroomid`, `studentname`, `startmonth`, `startyear`, `endmonth`, `endyear`) values (1,1,1,'ccc',3,2016,4,2017), (2,1,2,'bbb',05,2016,3,2017), (3,1,2,'aaa',12,2016,7,2017), (4,1,2,'bbb',05,2016,3,2017), (5,1,1,'bbb',09,2016,2,2017), (6,1,2,'bbb',06,2016,4,2017), (7,1,3,'bbb',03,2016,3,2017), (8,1,3,'bbb',01,2016,1,2017), (9,1,3,'bbb',11,2016,5,2017);
This query will provide you with the remaining seats in each class based on your month and year pairs.
select `classroomid`,'02' as `start_month`,'2016'`start_year`,'04'`end_month`,'2017'`end_year`,(20-count(`id`)) as `seats_left_in_class` from `test` where `startmonth`>=2 and `startyear`=2016 and `endmonth`<=4 and `endyear`=2017 group by `classroomid` order by `classroomid`;
You can check the results in SQL Fiddle