Faster SQL-query, huge performance improvement on installations with thousands of tickets.
perf: Slight simplification of SQL tweak

'where 1' and 'where 1=1' gives me hives...
Merge pull request #862 from greezybacon/issue/856

perf: Significant improvement fetching statistics

Reviewed-By: Peter Rotich <peter@osticket.com>