I have a table formatted similar to this:
Date | ID | Value | Difference
I need to get the difference between a record's value column, and the previous record's value column based off of the date.
I.E
2 days ago | cow | 1 | Null
Yesterday | cow | 2 | Null
Today | cow | 3 | Null
Yesterdays difference would be 1, and today's difference would be 1.
basically, I need to get the previous record based off the date, I don't know the interval's between each record. I've been stumped on this for a while. I am using Mysql, and Python to do the majority of the calculations.