请问如何在查询结果中返回序号?高分,在线 select id= identity(int,1,1),id,name into #hhh from studentselect * from #hhhdrop table #hhh 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select idd= identity(int,1,1),id,name into #hhh from studentselect * from #hhhdrop table #hhh --如果你的表中有主键(或不重复的字段),可以这样做:select 序号=(select sum(1) from 表 where 主键<=a.主键),*from 表 aorder by 主键 select rid= identity(int,1,1),id,name into #tmp from studentselect * from #tmp order by riddrop table #tmp select identity(int,1,1) as seq,id,name into #tab1 from studentselect * from #tab1drop #tab1关于IDENTITY()函数的用法可以参考SQL联机帮助的内容。 求一SELECT语句(关于自定义BIT字段显示) 请教SQL语句 请问SQL 2000中,关于索引和主键的问题 临时表和表变量 的区别 SQL Server 优秀版主评选活动开始了。。。。。 SQL语句查询结果导出到EXCEL ADODB.Recordset 错误 好象是连接。麻烦看一下。 哪位高手有可完成以下"先进先出法"存取数据的例子? 初学者的学习-11->Transaction Isolation Level 1。SQL 2000 是否支持跨数据库的外键?2。可否用视图作为主键表? 如何在win98上安装sql server 2000 服务器端? 关于插入数据的问题
select * from #hhh
drop table #hhh
from 表 a
order by 主键
select * from #tmp order by rid
drop table #tmp
select * from #tab1
drop #tab1
关于IDENTITY()函数的用法可以参考SQL联机帮助的内容。