got query to work on set interval