what's wrong with mysql?


  • 0
    H

    Interesting. exactly same solution, 1 work, 2 not work. what's wrong there?
    1:
    '''
    select case id%2
    when 0 then id-1
    when 1 && (id = (select max(id) from seat) )then id
    when 1 && ( id < (select max(id) from seat) )then id+1
    end as id, student
    from seat
    order by id asc
    '''

    2:
    '''
    select case id%2
    when 1 && (id = (select max(id) from seat) )then id
    when 1 && ( id < (select max(id) from seat) )then id+1
    when 0 then id-1
    end as id, student
    from seat
    order by id asc
    '''


Log in to reply
 

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