I have a table that looks like this:
TicketID SetStatus SetDate Count
100601BG15 Acknowledged 2010-06-01 14:02:45.330 1
100601BG15 Waiting on Business 2010-06-01 14:07:28.820 0
100601BG15 Pending 2010-06-01 14:07:40.597 1
100601BG15 Pending 2010-06-01 14:34:43.737 1
100601BG15 Pending 2010-06-03 18:29:47.120 1
100601BG15 Post Dated 2010-06-04 09:00:52.587 0
100601BG15 Post Dated 2010-06-07 12:42:37.960 0
100601BG15 Fulfilled 2010-06-07 14:38:29.677 1
I also have a function CalcMinutesSLA(Date1,Date2) that will calculate the difference between two dates excluding weekends and holidays.
Basically what i need is to calculate the difference in minutes between each date and the one before it and only the ones that have count set to 1.
So from the example above i would need the difference between Fulfilled and Post Date then from Post Dated to Pending and so on.