-- 保留前十条
DELETE table_name WHERE ID not in (SELECT TOP 10 ID from table_name ORDER BY ID )
-- 保留后十条
DELETE table_name WHERE ID not in (SELECT TOP 10 ID from table_name ORDER BY ID DESC)
删除表中前十条/后十条数据
-- 上面两条SQL去掉not即可
DELETE table_name WHERE ID in (SELECT TOP 10 ID from table_name ORDER BY ID )
DELETE table_name WHERE ID in (SELECT TOP 10 ID from table_name ORDER BY ID DESC)
SQL Server删除表,保留前十条/后十条数据-- 保留前十条DELETE table_name WHERE ID not in (SELECT TOP 10 ID from table_name ORDER BY ID )-- 保留后十条DELETE table_name WHERE ID not in (SELECT TOP 10 ID from table_name ORD...