如果想准确控制最多不会超过10条,应该只能用触发器
如果定时清理,假设是按照
主键排序,并且主键是自增先查出最新第10个主键ID,然后再删除主键小于"第10个主键ID"的所有记录DELETE tb FROM tb_name AS tb ,(SELECT pk_id FROM tb_name ORDER BY pk_id desc LIMIT 9,1) AS tmpWHERE tb.pk_id<tmp.pk_iddelete from `mygame_article` where title in (select title from `mygame_article` group by id having count(title) >1) and id not in (select max(id) from `mygame_article` group by title having count(title) >1)
随手写了个,前半句是选择title重复的数据,后半句是剔除id最大的,delete是删除的意思。。应该 思路是没问题的,这边不方便帮您测试
评论列表(0条)