create table test ( id int, name varchar(10), cj int, class int )insert into test select 1,'张',60,2 insert into test select 2, '张', 60 , 2 insert into test select 3, '张', 60 , 3 insert into test select 4, '张', 80 , 3 insert into test select 5, '王', 70 , 4 insert into test select 6, '王', 70 , 4select distinct * from test a where id in (select min(id) from test where name=a.name and cj=a.cj and class=a.class)drop table test
select * from test where [编号] in( select min([编号]) from test group by [姓名],[成绩],[班级] )
(
id int,
name varchar(10),
cj int,
class int
)insert into test select 1,'张',60,2
insert into test select 2, '张', 60 , 2
insert into test select 3, '张', 60 , 3
insert into test select 4, '张', 80 , 3
insert into test select 5, '王', 70 , 4
insert into test select 6, '王', 70 , 4select distinct *
from test a
where id in
(select min(id) from test where name=a.name and cj=a.cj and class=a.class)drop table test
where [编号] in( select min([编号]) from test group by [姓名],[成绩],[班级] )
select distinct 姓名,成绩,班级 from tablename