I have a T-SQL table where I have many transition statuses. For every transition pair (AVA_FROM -> AVA_TO) there is a timestamp and I should calculate every duration from