Say we have the following information:
ref_no customer dt_created
SO2553009 CN01806740 2015-08-20 11:10:51.770
SO2553264 CN01806740 2015-08-20 14:40:05.260
WW101120264 CN01806740 2015-08-19 21:55:32.990
This is 3 orders for a customer and represents a typical account profile.
I need to work out the Average time between the 3* datetime fields, in days (using datediff), because the department requesting the information wants to know the average time between orders.
If this cannot be done in SQL, I will try and mess with the information in SSRS, but the Report this is running already has multiple data-sets so I want to do most of the work in SQL to improve the user experience.
EDIT: I know i've tagged it, but it's worth mentioning this is SQL 2008 R2, so things like LEAD & ROW_NUMBER are not available.
* - this is not a fixed...