SELECT `n` . `id` , `n` . `bug_id` , `n` . `reporter_id` , `n` . `view_state` , `n` . `last_modified` , `n` . `date_submitted` , `b` . `project_id` FROM `mantis_bugnote_table` `n` JOIN `mantis_bug_table` `b` ON ( `n` . `bug_id` = `b` . `id` ) WHERE `n` . `bug_id` IN (...) ORDER BY `b` . `project_id` , `n` . `bug_id` , `n` . `last_modified` 