write select method