create interval query manually