create table tables(
id int,
na varchar(10),
nb varchar(10)
)
insert into tables values (1,'11','11')
insert into tables values (2,'12','12')
insert into tables values (3,'22','23')
insert into tables values (4,'63','50')
insert into tables values (5,'86','100')
select * from tables
现在要删除[na]列和[nb]列相同的数据,sql语句该怎么写呢?
delete from tables where id not in (select min(id) from tables group by [na],[nb] )
不得行了。是删除[na]列和[nb]列相同的数据
@Haydy: 行不行啊