mysql删除最大id的记录

版权声明:本文为博主原创文章,转载请说明出处 https://blog.csdn.net/u010002184/article/details/85717517

sql如下:

delete from area_table where id = select max(id) from area_table  -- 错误

delete a from area_table a ,(select  max(id) as max_id  from  area_table) b
where a.id=b.max_id -- 正常

版本:5.7.14

猜你喜欢

转载自blog.csdn.net/u010002184/article/details/85717517