Verwenden Sie einen Self-Join:
SELECT
t1.ts,
t1.number,
t1.number - COALESCE(t2.number, t1.number) AS diff
FROM yourTable t1
LEFT JOIN yourTable t2
ON t1.id = t2.id + 1
ORDER BY
t1.ts;
Verwenden Sie einen Self-Join:
SELECT
t1.ts,
t1.number,
t1.number - COALESCE(t2.number, t1.number) AS diff
FROM yourTable t1
LEFT JOIN yourTable t2
ON t1.id = t2.id + 1
ORDER BY
t1.ts;