SELECT `deadline`.`id`, `deadline`.`text`, `deadline`.`status`, `deadline`.`deadline_date`, (SELECT COUNT(comments.deadline_id ) FROM `comments` WHERE `comments`.`deadline_id`=`deadline`.`id`) AS `comments_count` FROM `deadline` WHERE `deadline`.`status`= 0