日期:2014-05-18 浏览次数:20555 次
declare @t table (ID int,ZiMu varchar(1),Shuzi int)
insert into @t
select 1,'A',1 union all
select 2,'B',1 union all
select 3,'C',1 union all
select 4,'A',2 union all
select 5,'B',2 union all
select 6,'C',2 union all
select 7,'A',3 union all
select 8,'B',3 union all
select 9,'C',3
select * from @t t where ID=(select min(ID) from @t where Shuzi=t.Shuzi)
/*
ID ZiMu Shuzi
----------- ---- -----------
1 A 1
4 A 2
7 A 3
*/