首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

怎么给结果集查询时带上序号

2012-04-22 
如何给结果集查询时带上序号rt[解决办法]http://www.2cto.com/database/201107/96429.htmlSQL SERVER的话

如何给结果集查询时带上序号
rt

[解决办法]
http://www.2cto.com/database/201107/96429.htmlSQL SERVER的话这里有详细介绍。

还有一种方式是在ADOQUERY中添加一个计算栏位。
[解决办法]
select px = (select count(1) from 
(
select a.type,b.type ,count(*) cnt FROM a ,b where b.r_id=a.r_id GROUP BY a.type,b.type
) m where cnt < n.cnt) + 1,* from
(
select a.type,b.type ,count(*) cnt FROM a ,b where b.r_id=a.r_id GROUP BY a.type,b.type
) n
)
--直接顺序用px = identity(int,1,1)
select px=identity(int,1,1) ,a.type,b.type ,count(*) cnt into tmp FROM a ,b where b.r_id=a.r_id GROUP BY a.type,b.type
select * from tmp

热点排行