SELECT wards_name AS 'Ward\'s Name',
wards_places AS 'Ward\s Places'
FROM wards, departments
WHERE wards_department_id = ANY (SELECT departments_id FROM departments WHERE wards_places > 15
AND departments_building = 5);
SELECT wards_name AS 'Ward\'s Name',
wards_places AS 'Ward\s Places'
FROM wards
INNER JOIN departments ON wards_department_id = departments_id
AND departments_building IN (SELECT departments_building
FROM wards
INNER JOIN departments ON wards_department_id = departments_id
AND wards_places > 15
AND departments_building = 5)
AND wards_places >= 5;