I have a SQL table where I need to work out the average time after each transactions:
The data looks like:
Tran1 07/09/2011 09:09:07 - CUSTOMER1
Tran2 07/09/2011 09:30:46 - CUSTOMER1
Tran3 07/09/2011 11:27:01 - CUSTOMER2
Tran4 07/09/2011 11:29:22 - CUSTOMER2
Tran5 07/09/2011 13:23:48 - CUSTOMER1
Tran6 08/09/2011 14:21:29 - CUSTOMER3
Tran7 08/09/2011 14:25:23 - CUSTOMER3
Tran8 10/09/2011 13:28:57 - CUSTOMER1
Tran9 10/09/2011 13:30:21 - CUSTOMER1
Tran10 10/09/2011 13:49:13 - CUSTOMER4
The table is Transaction Table and there are three columns:-
ID = UniqueID, TimeStamp = DataTime, CustomerId = UniqueID
So if I pass in a parameter DateTime.. let say '10/09/2011' The result Im trying to achieve is..
Date:10/9/2011 AverageQueueTime:3mins2secs - for exmaple