SELECT totalAmount
FROM tbl
BETWEEN 'date1' AND 'date2'
GROUP BY DATE(date created)
ORDER BY DATE(date created)
That gives me the total amount per day that is in the table. But what I want is the incremental value compared to the previous entry (not necessarily the previous day)
The table might be something like:
totalAmount | date created
---------------------------------
1000 | 1st Jan
1001 | 2nd Jan
1003 | 3rd Jan
1008 | 15th Jan
So where my query would return: 1000,1001,1003,1008.
What I actually want is: (a number compared to previous entry - but not within the BETWEEN date range in order to start my incriments),1,2,5