Можете да ГРУПИРАТЕ ПО и да изберете МАКС. позиция.
SELECT ri.*
FROM (
SELECT ri.release_id, MAX(ri.position) AS position
FROM release_image ri
GROUP BY ri.release_id
) ri_max
INNER JOIN release_image ri ON ri_max.release_id = ri.release_id
AND ri_max.position = ri.position