首页 > 其他 > 详细

601. 体育馆的人流量

时间:2020-03-27 11:52:07      阅读:70      评论:0      收藏:0      [点我收藏+]

601. 体育馆的人流量

暴力搜索条件

一开始不知道怎么去重,然后看了一眼评论区就行白了,直接 select s1.* 就可以对全表的数据进行去重

 

# Write your MySQL query statement below
select
    distinct s1.*
from
    stadium s1, stadium s2, stadium s3
where
    (s1.id + 1 = s2.id and s2.id + 1 = s3.id and s1.people >= 100 and s2.people >= 100 and s3.people >= 100)
or
    (s1.id - 1 = s2.id and s2.id - 1 = s3.id and s1.people >= 100 and s2.people >= 100 and s3.people >= 100)
or 
    (s1.id - 1 = s2.id and s1.id + 1 = s3.id and s1.people >= 100 and s2.people >= 100 and s3.people >= 100)
order by
    visit_date
asc
;

 

 

601. 体育馆的人流量

原文:https://www.cnblogs.com/letlifestop/p/12580336.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!