and sr1.Position
(2)换乘路线算法
显然,一条换乘路线由若干段直达路线组成(每段路线的终点与下一段路线的起点相同),因此,基于直达路线视图RouteT0可以很方便实现换乘查询,以下是实现一次换乘查询的存储过程InquiryT1:
InquiryT1
create proc InquiryT1(@StartStop varchar(32),@EndStop varchar(32))
as
begin
select
r1.StartStop as 启始站点,
r1.Route as 乘坐路线1,
r1.EndStop as 中转站点,
r2.Route as 乘坐路线2,
r2.EndStop as 目的站点,
r1.StopCount+r2.StopCount as 总站点数
from
RouteT0 r1,
RouteT0 r2
where
r1.StartStop=@StartStop
and r1.EndStop=r2.StartStop
and r2.EndStop=@EndStop
end
同理可以得到二次换乘的查询语句
InquiryT2
create proc InquiryT2(@StartStop varchar(32),@EndStop varchar(32))
as
begin
select
r1.StartStop as 启始站点,
r1.Route as 乘坐路线1,
r1.EndStop as 中转站点1,
r2.Route as 乘坐路线2,
r2.EndStop as 中转站点2,
r3.Route as 乘坐路线3,
r3.EndStop as 目的站点,
r1.StopCount+r2.StopCount+r3.StopCount as
文章来源于领测软件测试网 https://www.ltesting.net/