join statement to retrieve badges