SELECT `reporter_id` , STATUS , COUNT ( `id` ) AS `bugcount` FROM `mantis_bug_table` WHERE `reporter_id` IN (...) AND `project_id` = ? AND `mantis_bug_table` . `id` IN ( SELECT `mantis_bug_table` . `id` FROM `mantis_bug_table` JOIN `mantis_project_table` ON `mantis_project_table` . `id` = `mantis_bug_table` . `project_id` WHERE `mantis_project_table` . `enabled` = ? AND ( `mantis_bug_table` . `project_id` = ? ) ) GROUP BY `reporter_id` , STATUS ORDER BY `reporter_id` , STATUS 