Get MAX value in mysql query

前端 未结 3 1594
无人共我
无人共我 2021-01-05 05:38

I have a table

       id     mid    userid    remarks
       1       2       8          7 
       2       2       8          6
       3       2       8               


        
3条回答
  •  -上瘾入骨i
    2021-01-05 06:24

    Select Id,mid,userid,remarks from sample Where id<(select max(Id) from sample)
    order by id desc limit 1
    

    Or

    Select Id,mid,userid,remarks from sample 
    order by id desc limit 1 offset 1
    

提交回复
热议问题