代码语言:javascript复制
select id,visit_date,people
from(
select *,
lag(people,1) over(order by id)l1,
lag(people,2)over(order by id) l2,
lead(people,1) over(order by id)l3,
lead(people,2) over(order by id)l4
from stadium
)A
where (l1>=100 and l2>=100 and people>=100)
or(l1>=100 and people>=100 and l3>=100)
or(people>=100 and l3>=100 and l4>=100)