0626.sql (154B)
1 SELECT F.id, IFNULL(S.student, F.student) AS student 2 FROM Seat F 3 LEFT JOIN Seat S 4 ON F.id % 2 = 1 AND F.id + 1 = S.id 5 OR F.id % 2 = 0 AND F.id - 1 = S.id