Your dates are incorrect. When you order by this column, you order by day first. Proper ordering is year-month-day. Use the proper datatype, datetime or timestamp. To do this you can do the following:
alter table table1 add column d datetime;
update table1 set d = str_to_date(`Date`, '%d-%m-%Y %H:%i');
alter table table1 drop column `Date`;
The query to get your desired result is then:
SELECT ID, d, Value,
IF(@ID=ID, Value - @prevV, 'N/A') AS diff,
@row_number:=CASE WHEN @ID=ID THEN @row_number+1 ELSE 1 END AS row_number,
@prevV := Value,
@ID:=ID AS ID
FROM table1
, (SELECT @row_number:=0, @ID:='', @prevV := NULL) AS t
ORDER BY id, d;
All you have to do is add another variable to hold the value of the previous row.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…