当前位置:网站首页>sql server如何得到本条记录与上一条记录的差异,即变动值
sql server如何得到本条记录与上一条记录的差异,即变动值
2022-08-04 05:14:00 【CSDN问答】
工具:sql server 2008 r2
如何得到本条记录与上一条记录的差异,即变动值,如图表table:

流水号 姓名 日期 持股数
1001 张三 2022/3/31 10000
1001 张三 2022/1/10 15000
1001 张三 2021/12/31 20000
1001 张三 2021/9/30 10000
1001 张三 2021/9/29 8000
1001 张三 2021/6/30 10000
1001 张三 2021/3/31 15000
1001 张三 2020/12/31 20000
希望得到如下结果:
流水号 姓名 日期 持股数 变动
1001 张三 2022/3/31 10000 -5000
1001 张三 2022/1/10 15000 -5000
1001 张三 2021/12/31 20000 10000
1001 张三 2021/9/30 10000 2000
1001 张三 2021/9/29 8000 -2000
1001 张三 2021/6/30 10000 -5000
1001 张三 2021/3/31 15000 -5000
1001 张三 2020/12/31 20000 0
谢谢!
边栏推荐
- See how DevExpress enriches chart styles and how it empowers fund companies to innovate their business
- 【评价类模型】Topsis法(优劣解距离法)
- How to open a CITIC Securities online account?is it safe?
- C Expert Programming Chapter 5 Thinking about Linking 5.3 5 Special Secrets of Library Linking
- 入坑软件测试的经验与建议
- Shocked, 99.9% of the students didn't really understand the immutability of strings
- 深度学习21天——卷积神经网络(CNN):实现mnist手写数字识别(第1天)
- 7. The principle description of LVS load balancing cluster
- 震惊,99.9% 的同学没有真正理解字符串的不可变性
- 结构体函数练习
猜你喜欢

el-Select selector bottom fixed

【一步到位】Jenkins的安装、部署、启动(完整教程)

mysql index notes

转:管理是对可能性的热爱,管理者要有闯进未知的勇气

7. The principle description of LVS load balancing cluster

Teenage Achievement Hackers Need These Skills

触觉智能分享-SSD20X实现升级显示进度条

结构体函数练习
![[21 Days Learning Challenge] Image rotation problem (two-dimensional array)](/img/51/fb78f36c71e1eaac665ce9f1ce04ea.png)
[21 Days Learning Challenge] Image rotation problem (two-dimensional array)

深度学习21天——卷积神经网络(CNN):实现mnist手写数字识别(第1天)
随机推荐
离线采集怎么看sql执行计划
文献管理工具 | Zotero
static在不同位置定义变量居然还有不同的含义?
小程序 + 电商,玩转新零售
How to open a CITIC Securities online account?is it safe?
What are the steps for how to develop a mall system APP?
[21 Days Learning Challenge] Image rotation problem (two-dimensional array)
[C language advanced] program environment and preprocessing
Structure function exercise
Write golang simple C2 remote control based on gRPC
少年成就黑客,需要这些技能
C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.1 Arrays are not pointers
【21 Days Learning Challenge】Direct Insertion Sort
腾讯136道高级岗面试题:多线程+算法+Redis+JVM
DataTable uses Linq for grouping and summarization, and converts the Linq result set into DataTable
C Expert Programming Chapter 5 Thinking about Linking 5.3 5 Special Secrets of Library Linking
使用Loadrunner进行性能测试
结构体指针知识要点总结
JVM笔记
深度学习环境配置