注意:如果学生人数为奇数,则不需要改变最后一个同学的座位 select (case when id % 2 =0 and id !=(select count(*) from seat) then id-1 when id % 2 !=0 and id != (select count(*) from seat) then id+1 else id ) as id, studentfrom seatorder by id;