select identity(int, 1,1) as F1,* into #temp from 记录集 select * from #temp drop table #temp
Select no=(select count(*)+1 from bisfcdepa b where b.department_code<a.department_code),a.department_code from bisfcdepa a Order by a.department_code我的表名叫:bisfcdepa 其中含有字段department_code 并且department_code为关键字段
select (select sum(1) from yourtable where col<=tem.col) as NO,* from yourtable as tem
select * from #temp
drop table #temp
Order by a.department_code我的表名叫:bisfcdepa
其中含有字段department_code 并且department_code为关键字段