Best approach for sorting by relationship count

Hello !

Did you find a solution ?