SELECT a.*, count(b.id) as num FROM `tcyun_exam` `a` INNER JOIN `tcyun_exam_question` `b` ON `a`.`id`=`b`.`examid` WHERE `a`.`id` IN ('87','88','89','801','802','803','804','805','806','807','1018','1278','1642','1643','1644','1966','2277','2556','2757') AND `a`.`cate` = '3' GROUP BY `b`.`examid`