I have the following table structure with data as
ReadingDate Unit
01-05-2011 10
01-06-2011 20
01-07-2011 40
01-08-2011 40
AND I want to the following result with T-Sql query. I am using sql server 2008 R2
ReadingDate Unit UnitConsumed
01-05-2011 10 10
01-06-2011 20 10
01-07-2011 40 20
01-08-2011 40 0
You could try the following:
Plain and simple !