Background:
The airline is auditing its Passengers Reservation. Each Passenger may have
unlimited flight changes, and the flight tariff will be adjusted.
Question: To find the changes for each passenger.
Reservation_Table:
ReservationID, Name, flight, ..., Tariff, NewReservationID
1, Beijing, UA917, ..., 3
2, ..., null
3, Beijing, UA816, ..., 100
4, ..., null
...
100, Beijing, UA998, .., m
...
m, Beijing, ...., null
...
n,...
One approach: cursor, identify the reservation update one by one, and loop.
Definitely low performance.
Any better approach? e.g. recursive query? Or a function to call itself(put the output as input till null)?