executeQuery function

Execute a query