adding prior query count query