Sql, Spl, Database.
to_date('2021–01–10') and e2.etime<to_date('2021–01–25') and e2.etime > t1 and e2.etime < t1 + 7 and eventtype='eventtype2' and … group by 1), e3 as ( select uid,1 as step3,min(e2.t1) as t1,min(e3.etime) as t3 from event as e3 inner join e2 on e3.uid = e2.uid where e3.etime>= to_date('2021–01–10')