difference-between-rows

SQL To find difference between multiple rows

I have a table containing multiple records for different transactions i.e. ID Date REF 1 01/09/2008 A 1 11/09/2008 A 1 01/10/2008 A 2 01/09/2008 A 2 01/10/2008 A 2 01/11/2008 B 2 01/12/2008 B and I'm looking to summarise the data so that I have the average days for each id and ref... i.e. ID Ref ...

Calculate Time Difference Between Two Rows SQL Server

I have a table that contains the following: DataDate Value 2010-03-01 08:31:32.000 100 2010-03-01 08:31:40.000 110 2010-03-01 08:31:42.000 95 2010-03-01 08:31:45.000 101 . . . . . . I need to multiply the value column by the difference in time bet...