sql to calculate daily totals minues the previous day's totals
I have a table that has a date, item, and quantity.

I need a sql query to return the totals per day, but the total is the quantity minus the previous day totals.  The quantity accumulates as the month goes on. So the 1st could have 5 the 2nd have 12 and the 3rd has 20.

So the 1st adds 5
2nd adds 7 to make 12
3rd adds 8 to make 20.

I've done something like this in the past, but can not find it or remember. I know i'll need a correlated sub-query.

TIA
sql to calculate daily totals minues the previous day's totals
===

I have a table that has a date, item, and quantity.

I need a sql query to return the totals per day, but the total is the quantity minus the previous day totals.  The quantity accumulates as the month goes on. So the 1st could have 5 the 2nd have 12 and the 3rd has 20.

So the 1st adds 5
2nd adds 7 to make 12
3rd adds 8 to make 20.

I've done something like this in the past, but can not find it or remember. I know i'll need a correlated sub-query.

TIA