use a temp table for find_in_batches when select does not include id

also add hash of query to temp table name. this fixes nested
queries, but also defeats query cache getting confused

fixes CNVS-13783

test plan:
 * *don't* have a slave configured in database.yml
 * run the last_user_access report
 * it should work

Change-Id: I6fba9826f6cfee5a2e651157fd898f42c0e1345e
Reviewed-on: https://gerrit.instructure.com/36911
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>