[qtcontacts-sqlite] Use named parameters in temp table queries

Also, small speed improvement in aggregation query.