Will text always contain 'Start' for the earliest entry and 'End' for the latest?Declare @t table ( id int, t time, l varchar(10))Insert Into @t Select 1, '5:30:00', 'Start'Insert Into @t Select 1, '5:31:00', 'Middle'Insert Into @t Select 1, '5:33:00', 'End'Insert Into @t Select 2, '5:31:00', 'Start'Insert Into @t Select 2, '5:35:00', 'Middle'Insert Into @t Select 2, '5:39:00', 'End'Select * From @tSelect A.id, A.t, B.t, DATEDIFF(MI, a.t, b.t), convert(time,dateadd(mi,DATEDIFF(MI, a.t, b.t),0))From @t AInner join @t BOn A.id = B.idand 'End' = B.lWhere A.l = 'Start'
Corey
I Has Returned!!