SQL里面如何返回行信息 SQL里面如何返回行信息我用SELECT语句查出了需要的资料,但还差一列序号,按查出的资料第一条记录为一,第二条为二。请大家帮帮小弟! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select *,identity(int,1,1) TID into #tempfrom tableName--此表可以是记录集。。 --可以借助临时表处理。create table #t(num int )insert #t select 20insert #t select 26insert #t select 45select * from #tselect identity(int,1,1) as id,*into #tpfrom #tselect * from #tpdrop table #t,#tp 考虑下面的方法:USE pubsSELECT seq_id = Count(*), au_a.au_id, au_a.au_lname, au_a.au_fname, au_a.phone, au_a.address, au_a.city, au_a.state, au_a.zip, au_a.contractFROM authors au_a,authors au_bWHERE au_a.au_id >= au_b.au_id --一定要用主键GROUP BY au_a.au_id, au_a.au_lname, au_a.au_fname, au_a.phone, au_a.address, au_a.city, au_a.state, au_a.zip, au_a.contract建议你最好在前台程序中实现. --假设表中有唯一字段ID,可以使用如下SQL:select (select count(*) from 表名 where ID <= A.ID) as 序号,*from 表名 A C++如何保存SQL中读出来的decimal类型? 鸭子.... 来领分 简单的sql语句 关于分页查询和行转列结合使用的问题 数据库设计的疑问,请 运行SQL语句报错 打不开数据库,菜鸟求救! 求求我呀,这语句该怎么写(分页语句)? 不能在手动或分布事务方式下创建新的连接 请问如何在这个语句的基础上计算合计! 多个case的用法. 怎么将两个表的各行合并呢
from tableName--此表可以是记录集。。
--可以借助临时表处理。create table #t(num int )insert #t select 20
insert #t select 26
insert #t select 45select * from #tselect identity(int,1,1) as id,*
into #tp
from #tselect * from #tpdrop table #t,#tp
USE pubs
SELECT seq_id = Count(*),
au_a.au_id,
au_a.au_lname,
au_a.au_fname,
au_a.phone,
au_a.address,
au_a.city,
au_a.state,
au_a.zip,
au_a.contract
FROM authors au_a,authors au_b
WHERE au_a.au_id >= au_b.au_id --一定要用主键
GROUP BY au_a.au_id,
au_a.au_lname,
au_a.au_fname,
au_a.phone,
au_a.address,
au_a.city,
au_a.state,
au_a.zip,
au_a.contract建议你最好在前台程序中实现.
from 表名 A