SQL中数据分组重新编号
declare @t table(a int,b int)
insert into @t select 12, 34
union all select 12, 56
union all select 12, 23
union all select 13, 33
union all select 14, 11
union all select 14, 15
select *,c=(select count(*)+1 from @t where a=t1.a and b <t1.b)
from @t t1 order by a,b