DEV Community

Miss Pooja Anilkumar Patel
Miss Pooja Anilkumar Patel

Posted on

626. Leetcode SOLUTION

`

Write your MySQL query statement below

select (
case
when id % 2 = 0 then id - 1
when id = (select max(id) from seat) then id
else id + 1
end
) as id, student
from seat
order by id;

`

Discussion (0)