我要删除table表里面ID字段500条数据以后的数据的sql语句怎么写,请教!

如题所述

第1个回答  2011-09-02
delete from 表名 where id not in (select top 500 * id from table order by id asc)

select top 500 * id from 表名order by id asc//查询表中钱500数据根据id按升序排列
delete from 表名 where id not in (select top 500 * id from table order by id asc)
就是删除表中不是前500条的数据
第2个回答  2011-09-06
delete from table where id>=500;
第3个回答  2011-09-02
ID字段500?讲明白点
第4个回答  2011-09-02
delete from table where id not in (select top 500 id from table)本回答被提问者采纳
相似回答