文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>更新 Sql排序

更新 Sql排序

时间:2011-03-21  来源:默西塞德

CREATE TABLE [dbo].[CustomerTrack](
 [ID] [int] IDENTITY(1,1) NOT NULL,
 [CustomerID] [uniqueidentifier] NULL,
 [Channel] [int] NULL,
 [OrderIndex] [int] NULL,
 [Value] [nvarchar](50) NULL,
 CONSTRAINT [PK_CustomerTrack] PRIMARY KEY CLUSTERED
(
 [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
  ---------------   上表增删改之后,下述脚本更新orderindex with r_SomeTable
as
(
select *
, row_number() over(partition by IDCol order by ValueCol) as rnk
from SomeTable
)
update r_SomeTable
set RANKCol = rnk
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载