selectQuery method