SELECT r.*, r.`seats`- COUNT(re.`id`) as seatsFree FROM `tours` as r
LEFT JOIN `requests` as re ON re.`tour_id`=r.`id` and re.`visible`=1 and re.`status`=3
WHERE COUNT(re.`id`)>5
group by r.`id`
WHERE COUNT(re.`id`)>5
SELECT r.*, r.`seats`- COUNT(re.`id`) as seatsFree FROM `tours` as r
LEFT JOIN `requests` as re ON re.`tour_id`=r.`id` and re.`visible`=1 and re.`status`=3
WHERE 1
group by r.`id`
HAVING (seatsFree <=90)
ORDER BY r.`finished` DESC
LIMIT 0,2
SELECT COUNT(r.id) as num, r.`seats`- COUNT(re.`id`) as seatsFree FROM `tours` as r
LEFT JOIN `requests` as re ON re.`tour_id`=r.`id` and re.`visible`=1 and re.`status`=3 WHERE 1 group by r.`id` HAVING (seatsFree <=90) order by num desc
LIMIT 1