写个触发器吧。在每次插入记录的时候触发,用count(*)判断是否等于10.大于10的话就按id删除最后那条记录就可以了
只是显示保持10行
Select top 10 * from ta where a=e // sql server
select * from ta where a=e and rownum=10 // oracle
delete ta where 1=1
and a=e
and d not in (select top 10 id from ta where a=e order by 时间 desc)
select top 10 * from bbb