体育馆的人流量 sql
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/human-traffic-of-stadium
我的解答:
select ts1.* from(
select s1.id as si1,s2.id as si2,s3.id as si3 from Stadium as s1,
Stadium as s2,
Stadium as s3
where s1.people>=100 and
s2.people>=100 and
s3.people>=100 and
s3.id=s2.id+1 and
s2.id=s1.id+1
) as t
left join Stadium as ts1
on ts1.id>=t.si1 and ts1.id<=t.si3
group by ts1.id
order by ts1.visit_date