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 ('653','657','660','662','1226','1227','1228','1229','1230','1243','1645','1646','1893','1960','2278','2774') AND `a`.`cate` = '3' GROUP BY `b`.`examid`