SELECT DISTINCTROW `mantis_bug_table` . * , COALESCE ( `reporter_id_sort_table` . `username` , `CONCAT` ( ? , `mantis_bug_table` . `reporter_id` ) ) AS `reporter_id_sort_alias` FROM `mantis_bug_table` JOIN `mantis_project_table` ON `mantis_project_table` . `id` = `mantis_bug_table` . `project_id` LEFT JOIN `mantis_user_table` `reporter_id_sort_table` ON `mantis_bug_table` . `reporter_id` = `reporter_id_sort_table` . `id` WHERE `mantis_project_table` . `enabled` = ? AND ( `mantis_bug_table` . `project_id` = ? ) AND ( `mantis_bug_table` . `status` = ? ) ORDER BY `mantis_bug_table` . `sticky` DESC , `mantis_bug_table` . `last_updated` ASC , `mantis_bug_table` . `status` ASC , `reporter_id_sort_alias` DESC , `mantis_bug_table` . `date_submitted` DESC LIMIT ?, ... 