SQLserver2000 字段排序

Declare  @tb TABLE (Id int IDENTITY,fdate datetime,fzqdm bigint,fkmdm varchar(50),facctname varchar(50),facctattr varchar(50),facctattrid varchar(10),fzqsl numeric(18,4),fzqsz numeric(18,facctlevel varchar(10),fby varchar(10),fcurcode varchar(10))


insert into @tb(fdate,fzqdm,fkmdm,facctname,facctattr,facctattrid,fzqsl,fzqsz,facctlevel,fby,fcurcode)

select fdate,fcurcode from table1

 

 

select  count(*) from @tb      
where id<=t.id and fzqdm=t.fzqdm and facctattrid = t.facctattrid and fdate=t.fdate and fby=t.fby and fcurcode=t.fcurcode),t.*
                  from @tb t

 

红色代码是不可少的,绿色部分相当于row_numbers()函数中的partition by部分。

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 &#39;EastRiver&#39; 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...