change query to find total number of books