Using self join and abs()


  • 0
    C
    select distinct a.seat_id from
    cinema a, cinema b
    where (a.free=1 and b.free=1) and (abs(a.seat_id-b.seat_id)=1 )
    order by a.seat_id
    

Log in to reply
 

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