SELECT `B` . `id` AS `bug_id` , `CF` . `id` AS `field_id` , `CFS` . `value` , `CFS` . `text` FROM `mantis_bug_table` `B` LEFT OUTER JOIN `mantis_custom_field_table` `CF` ON ? = ? LEFT OUTER JOIN `mantis_custom_field_string_table` `CFS` ON ( `B` . `id` = `CFS` . `bug_id` AND `CF` . `id` = `CFS` . `field_id` ) WHERE `B` . `id` IN (?) AND `CF` . `id` IN (?) 