|
declare @t table(student number int identity(1,1),
Name varchar(30), gender nvarchar(1), age int)
insert into @t
select'xw','male',18 union all
select'mc','女',18 union all
select'mc','女',18 union all
select'mc','女',18 union all
select'ww','male',21 union all
select'xw','male',18 union all
select'xw','male',18
select * from @t
delete from @t
where student number
in
(
select b. Student ID
from @t b
inner join
(
select name, gender, age
from @t
group by name, gender, age
having count(1)>1
) a
on a. name=b. name and a. gender=b. gender and a. age=b. age
)
select * from @t
--------------------
What you asked is wrong. Here it is. The NET section is much worse than the SQL section after all |
|