Accepted Solution without using join or in


  • 0
    SELECT  c1.seat_id
    FROM    cinema c1
    WHERE   c1.free = 1 
        AND EXISTS (
            SELECT *
            FROM   cinema c2
            WHERE  (c1.seat_id = c2.seat_id - 1
                OR  c1.seat_id = c2.seat_id + 1)
                AND c2.free = 1
            )
    ORDER BY c1.seat_id
    
    

Log in to reply
 

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