make template for query