Вы можете рассчитать его за два шага, во-первых, мы добавляем дату прибытия и ticket_id к каждому отправлению.
И, во-вторых, мы только возвращаем отправления новых циклов, проверяя, что их ticket_id больше, чем каждый предыдущий прибытие ticket_id.
with DeparturesAndArrivals as (
select Departure.Ticket_ID, Departure.Employee, Departure.[From], Departure.Departure,
Arrival.Departure as Arrival, Arrival.Ticket_ID as Arrival_Ticket_ID
from employee_travel as Departure
outer apply (select top 1 Ticket_ID, Departure
from employee_travel as Arrival
where Arrival.Employee = Departure.Employee and
Arrival.[To] = Departure.[From] and
Arrival.Ticket_ID > Departure.Ticket_ID
order by Arrival.Ticket_ID) as Arrival
)
select Ticket_ID, Employee, [From], Departure, Arrival
from DeparturesAndArrivals as Departures
where Ticket_ID > (select coalesce(max(PreviousArrivals.Arrival_Ticket_ID), -1)
from DeparturesAndArrivals as PreviousArrivals
where PreviousArrivals.Employee = Departures.Employee and
PreviousArrivals.Ticket_ID < Departures.Ticket_ID)