Fixed query for when no groups exist.