Returning total number of results when running a query