create select statment based on dynamic input.