n********6 发帖数: 1511 | 1 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)? | a9 发帖数: 21638 | 2 cte
have
【在 n********6 的大作中提到】 : 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
| n********6 发帖数: 1511 | 3 thank you.
【在 a9 的大作中提到】 : cte : : have
|
|