SELECT e.*
FROM employee e
INNER JOIN (SELECT*FROM appointment WHERE start_time BETWEEN '09:00:00' AND'09:01:00') a ON a.service_id = e.service_id AND a.employee_id = e.employee_id
LEFT JOIN (SELECT employee_id, service_id, COUNT (id) AS count_empl FROM appointment GROUP BY employee_id, service_id) a2 ON a2.employee_id = e.employee_id AND a2.service_id = e.service_id
WHERE a2.count_empl <= 3