如果use表有主键的话就可以做到,假设是userid。
开始我想的是:
delete from user where userid in (select userid from user limit 4,8);
但mysql的报错是:The version of Mysql doesn't yet support 'LIMIT &IN/ALL/ANY subquery'。就是现版本不支持limit 和 in all any 联合的子查询。
换一种思路如下:
delete from user where exists (select * from (select userid from user limit 4,8) as a where a.userid=user.userid);
就可以了,用到了相关子查询。