Du kan använda aggregering: select up, max(code_dept) as code_dept from ESP_ENSEIGNANT ee group by up;