solution with group by


  • 0
    S

    select * from stadium where id in (
    select id from stadium where people >= 100 group by floor(id/3) having count(1) = 3 union select id from stadium where people >= 100 group by floor((id+1)/3) having count(1) = 3 union select id from stadium where people >= 100 group by floor((id+2)/3) having count(1) = 3
    ) or id - 1 in (
    select id from stadium where people >= 100 group by floor(id/3) having count(1) = 3 union select id from stadium where people >= 100 group by floor((id+1)/3) having count(1) = 3 union select id from stadium where people >= 100 group by floor((id+2)/3) having count(1) = 3
    ) or id - 2 in (
    select id from stadium where people >= 100 group by floor(id/3) having count(1) = 3 union select id from stadium where people >= 100 group by floor((id+1)/3) having count(1) = 3 union select id from stadium where people >= 100 group by floor((id+2)/3) having count(1) = 3
    )


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.