finding heads for groups with zero ones in database