Make query interval parameterized