modify query to match values for email intervals