MBS-5732: Refactor the 'used in relationship' SQL