由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 类似gapover发的帖:问个sql问题
相关主题
How can I find source code about this?question about MS SQL mirroring...
how to store a trie into database?beijing在job版上帮谁收简历呢?
怒了!!没人回答俺问题?要回国腐败了.
Beijing....beijing你做过swt么?帮忙弄下界面。
beijing好可怜看来版主翻墙有困难, 有日子没来了。
累死了。Re: Demand data out!
来说说上次发的微软面试题 1老泪纵横
以后不能站岗了。 (转载)我一直以为beijing是个mm
相关话题的讨论汇总
话题: beijing话题: null话题: flight话题: tariff
进入Database版参与讨论
1 (共1页)
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

1 (共1页)
进入Database版参与讨论
相关主题
我一直以为beijing是个mmbeijing好可怜
版聚花絮 (转载)累死了。
beijing你老婆喊你回家吃饭来说说上次发的微软面试题 1
DC版的Beijing是男人还是女人? 很好奇 (转载)以后不能站岗了。 (转载)
How can I find source code about this?question about MS SQL mirroring...
how to store a trie into database?beijing在job版上帮谁收简历呢?
怒了!!没人回答俺问题?要回国腐败了.
Beijing....beijing你做过swt么?帮忙弄下界面。
相关话题的讨论汇总
话题: beijing话题: null话题: flight话题: tariff