Add total count to query