script to run select query