select ouv_id, row_number() OVER (PARTITION BY ouv_id) as num from ouvrage....