sql 语句查询问题(简单的查询)在线等 id是自动增长 id name 1 1 一2 3 三3 4 四4 7 七5 8 八6 9 九 我想在后面在写一个临时查询列名。结果如下 id name Dataid1 1 一 1 2 3 三 23 4 四 34 7 七 45 8 八 56 9 九 6 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select id,name,(select count(*) from tb where id<=t.id) as dataidfrom tb t select id,name DataId=(select count(1) from [Table] where id<=a.id)from [Table] a select a.id,a.name,Dataid=count(b.id) from 表 a,表 b where a.id>=b.id group by a.id,a.name --2005或以上select id,name,row_number() over(order by id) as dataidfrom tb select a.id, a.name, dataid =(select count(*) from table where id <= a.id)from table a select id,name,id as Dataid from table select *,identity(int,1,1)Dataid into # from tbselect * from #drop table # 请教一句SQL,谢谢 应该不难,但我不会!!!SQL2000操作问题 数据库用户问题! windows xp下安装sql sever2000安装求助 字段用汉字命名是否会有什么隐患 请教insert 语句 查询结果排序问题请教! 如何在SP中返回多行结果? 请问如何取得一个字段的描述(说明)? Access数据库最大容量有多大?如满了该怎么再增加? sql语句 求一个字符中取数字的函数,有些许要求
from tb t
from [Table] a
select id,name,row_number() over(order by id) as dataid
from tb
select
a.id,
a.name,
dataid =(select count(*) from table where id <= a.id)
from table a
select id,name,id as Dataid from table
select * from #
drop table #