if(id < (select count(*) from seat), if(id mod 2=0, id-1, id+1), if(id mod 2=0, id-1, id)) as id, student
order by id asc;
use 2 if() instead of 3:
select if (
if( id<> (select max(id) from seat), id+1, id),
) id, student from seat order by id;
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.