SELECT DISTINCTROW `p` . `id` , `p` . `name` , `p` . `view_state` , `u` . `access_level` FROM `mantis_project_table` `p` LEFT JOIN `mantis_project_user_list_table` `u` ON `p` . `id` = `u` . `project_id` WHERE `p` . `enabled` = ? AND `u` . `user_id` = ? ORDER BY `p` . `name` 