Primero, te falta un GROUP BY
cláusula en la parte inferior de su consulta para agrupar por school_name
:
SELECT count(student_name) AS total_student, school_name
FROM student
LEFT JOIN school_info ON school_info.school_id = student.school_id
WHERE student.status = '0'
GROUP BY school_name
Luego, si simplemente no desea mostrar filas donde total_student =0, puede usar la cláusula HAVING de MySQL:
SELECT count(student_name) AS total_student, school_name
FROM student
LEFT JOIN school_info ON school_info.school_id = student.school_id
WHERE student.status = '0'
GROUP BY school_name
HAVING count(student_name) > 0
O bien, puede cambiar LEFT JOIN
a INNER JOIN
para lograr lo mismo en este caso.
Finalmente, si desea reemplazar 0 con nulo pero aún tiene filas, puede actualizar la declaración de selección para obtener los totales a:
SELECT IF(COUNT(student_name) = 0, NULL, COUNT(student_name)) AS total_student, school_name