create table t(na char(10),va numeric(8,2))
insert into t values('a',80)
insert into t values('b',70)
insert into t values('c',70)
insert into t values('d',90)
insert into t values('e',80)
insert into t values('f',100)
insert into t values('g',80)
goselect *,new1=identity(int,1,1) into #t1 from t order by vaselect na,va,(select min(new1) from #t1 b where b.va = a.va),new1
from #t1 a
order by new1