Correct query for retrieving badge for displaying in the account page