basic function for getting query results from sql api
construct sql query from provided request parameters