I'm trying to subtract the previous value from the current value to get a delta of change but I'm struggling on figuring out how to do this. I tried to start with a query to get the top two rows by DateTime DESC so I'd get both rows I'm interested in. Now I'm trying to figure out how to get access to the second row value only. I feel like there's something I'm missing and any help would be greatly appreciated.
What I'm starting with:
SELECT TOP 2 NodeID, InterfaceID, DateTime, InAveragebps
Where InterfaceID = 342 and NodeID = 70
Order by DateTime DESC
Kicking around the idea of summing the data and then subtracting the value for the max row to get the value for the second row out but there has to be a better way...