| 
 | 
 
 
发表于 2020-8-4 22:30:01
|
显示全部楼层
 
 
 
declare @t table(学号 int identity(1,1), 
姓名 varchar(30),性别 nvarchar(1),年龄 int) 
 
insert into @t 
select 'xw','男',18 union all 
select 'mc','女',18 union all 
select 'mc','女',18 union all 
select 'mc','女',18 union all 
select 'ww','男',21 union all 
select 'xw','男',18 union all 
select 'xw','男',18 
 
select * from @t 
 
delete from @t 
where 学号 
in  
( 
        select b.学号 
        from @t b 
        inner join  
        ( 
                select 姓名,性别,年龄 
                from @t 
                group by  姓名,性别,年龄 
                having count(1)>1 
        ) a 
        on a.姓名=b.姓名 and a.性别=b.性别 and a.年龄=b.年龄 
) 
 
select * from @t 
-------------------- 
你问的地方不对 这里是。NET版块 毕竟比SQL版块差多了 |   
 
 
 
 |