How can I avg(time(4)) in the following query:
select top 10 avg(e.Duration) from TimeTable e
I\'m getting the following error:
You can use DateDiff( ms, '00:00:00', e.Duration ) to convert the time into an integer number of milliseconds. Use that for your aggregate, then convert the result back, e.g. Cast( DateAdd( ms, 1234, '00:00:00' ) as Time ).
DateDiff( ms, '00:00:00', e.Duration )
Cast( DateAdd( ms, 1234, '00:00:00' ) as Time )