度量快速开发平台-专业、快速的软件定制快开平台
标题: SQL计算上下两行某列的差 [打印本页]
作者: fteair 时间: 2020-3-20 15:14
标题: SQL计算上下两行某列的差
SELECT * FROM #TempHuDong
SELECT * FROM #TempHuDong
SELECT TOP 1 ABS(a.num -b.num) '差'
FROM (select row_number()over(order by getdate()) as id,* from #TempHuDong) as a
LEFT JOIN (select row_number()over(order by getdate()) as id,* from #TempHuDong) as b
ON a.id = b.id - 1
作者: fteair 时间: 2020-3-23 17:45
作者: fteair 时间: 2020-3-23 17:46
作者: fteair 时间: 2020-3-23 17:47
作者: fteair 时间: 2020-3-23 17:48
欢迎光临 度量快速开发平台-专业、快速的软件定制快开平台 (http://plat.delit.cn/) |
Powered by Discuz! X3.2 |