I have a table with 2 columns, the date and the value for the date, e.g.
date value
2015-09-01 15
2015-09-02 17
2015-09-03 21
and I want to create a column with the difference between the value and the value of the last day, like
date difference
2015-09-01 NULL
2015-09-02 2
2015-09-03 4
Can this be done with MySQL?
Best Answer
PROPOSED QUERY #1
SAMPLE DATA
PROPOSED QUERY #1 EXECUTED
PROPOSED QUERY #2
PROPOSED QUERY #2
This will give you the exact output you display in the question
GIVE IT A TRY !!!