select ID from hit_table where time between ? and ? order by visit_id, time