Added interval condition for query