Make sql statements work.
Fix sql
Track the time by job item rather than job.
Fix typo.
Revert to using job commit id
Merge pull request #713 from nla/bug/acm-dsc-792

Fix issue where upload stats were taking hours to generate dsc-791