You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY tags.nome ORDER BY tipo DESC, tags.ordem' at line 2
SELECT tags.nome, tags.nome2, tags.id FROM tags,rel WHERE tags.id IN (SELECT rel.id2 FROM rel WHERE id1=) GROUP BY tags.nome ORDER BY tipo DESC, tags.ordem