你把“表”、“日期”换成你自己的试试:select IDENTITY(int,1,1) as sn, * into #t1 from 表 order by 日期select b.rq + right('0000' + rtrim(convert(char(10), a.sn-b.snmin+1)), 4) as sn1, * from #t1 a inner join (select convert(char(8), 日期, 112) rq, min(sn) snmin from #t1 group by convert(char(8), 日期, 112)) b on convert(char(8), a.日期, 112)=b.rq order by sn1drop table #t1
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货