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
|