format query