Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
在 SQL Server 中,窗口函数 sum() over() 应该可以解决这个问题。
sum() over()
请注意 order by ColB ...这只是一个占位符,我怀疑您还有另一列具有正确的序列
order by ColB
示例
Select ColA ,ColB ,ColC = sum(ColB) over (partition by ColA order by ColB rows unbounded preceding ) From YourTable
In SQL Server, the window function sum() over() should do the trick.
Note the order by ColB ... This is just a placeholder, I suspect you have another column which would have the proper sequence
Example
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
在 SQL Server 中,窗口函数
sum() over()
应该可以解决这个问题。请注意
order by ColB
...这只是一个占位符,我怀疑您还有另一列具有正确的序列示例
In SQL Server, the window function
sum() over()
should do the trick.Note the
order by ColB
... This is just a placeholder, I suspect you have another column which would have the proper sequenceExample