在mysql中delete语句中如何使用limit语句。
用delete from table where userId = 18 limit 4;
可以删除成功。
但是我遇到的问题是删除指定行之后的。比如第10行之后。
用delete from table where userId = 18 limit 10,-1; 却不可行,老是报错。
不明白原因,请各位大哥指教下。
用delete from table where userId = 18 limit 4;
可以删除成功。
但是我遇到的问题是删除指定行之后的。比如第10行之后。
用delete from table where userId = 18 limit 10,-1; 却不可行,老是报错。
不明白原因,请各位大哥指教下。
这种是不合法的,即便是select 语句也过不了你可以用 select count(1) from table where userId = 18; 得到的数字 比如是100,
那么可以 delete from table where userId = 18 limit 10,90;
delete from table where userId = 18 limit 9,100000
LIMIT第一个参数,从第几条记录开始,从0开始算
第二个参数,取几条记录
create table newtt select * from tt limit 5,10
生成新表