SELECT id, nome, ... FROM table AS t, table AS t, ... LEFT JOIN table as t ON t.field = t.field AND t.field = t1.field ... WHERE field = value AND field = value ... ORDER BY field ASC, ... GROUP BY field, ... LIMIT 1/1