没有主键,似乎做不到,你可以给原表添加主键,代码如下: alter table yourTable add ID bigint identity(1,1) not null 虽然没有指定是primaryKey,但对已有数据增加自增列,那就是主键 然后用2#写法,或者 delete from yourTable where ID not in(select top 1 ID from yourTable where fieldA='a')
alter table yourTable add ID bigint identity(1,1) not null
delete from yourTable where ID not in(select top 1 ID from yourTable where fieldA='a')
第一条,以什么为排序呢。
请提供可测试的表结构数据。
110,539
社区成员
642,577
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧