今天想要操作mysql,修改mysql第二条最新的数据内容时出现错误:This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery',内层select语句不能带有limit语句,如下:
update table
set name = '2022-09'
where id in (select id from table Order By id desc limit 1,1) limit1;
原因是内层select语句不能带有limit语句,可在子查询中多嵌套一层
update table
set name = '2022-09'
where id in (select t1.* from (select id from table Order By id desc limit 1,1) as t1) limit1;
网友评论