Okay so first
async getPRMsAvailability() {
var prmsData = await getManager().query(
'SELECT SQL_NO_CACHE prm.id, prm.firstName, prm.lastName, COUNT(student.id) as students FROM prm LEFT JOIN student ON prm.id = student.prm_id group by prm.id order by count(student.id) asc limit 1'
);
return prmsData;
}
This is the code that is already present in my file what this code does is from the prm table it takes id, firstname, lastname and assigns it to the total count of student ids present in student table the only change I want here is that it should also consider the status column from the student table and only consider it for those students whose status(student.status) is active and not all students.