日期:2014-05-16  浏览次数:20768 次

一个access数据库问题。
我想保留表中最新的30个数据(有记录时间的字段addtime),其余的删除,请问sql语句怎样写呢?谢谢。

------解决方案--------------------
delete from table1 where id not in (select top 30 id from table1 order by addtime desc)
------解决方案--------------------
用top查询前30条数据 并且根据时间排序