begin
select
r1.startStop as startStop,
r1.routeName as route1,
r1.endStop as transitStop1,
r2.routeName as route2,
r2.endStop as transitStop2,
r3.routeName as route3,
r3.endStop as endStop,
r1.stopCount+r2.stopCount+r3.stopCount as stopCount
from
routeT0 r1,
routeT0 r2,
routeT0 r3
where
r1.startStop=sStop
and r1.endStop=r2.startStop
and r2.endStop=r3.startStop
and r3.endStop=eStop order by stopCount asc;
select
r1.startStop as startStop,
r1.routeName as route1,
r1.endStop as transitStop1,
r2.routeName as route2,
r2.endStop as transitStop2,
r3.routeName as route3,
r3.endStop as endStop,
r1.stopCount+r2.stopCount+r3.stopCount as stopCount
from
routeT0 r1,
routeT0 r2,
routeT0 r3
where
r1.startStop=sStop
and r1.endStop=r2.startStop
and r2.endStop=r3.startStop
and r3.endStop=eStop order by stopCount asc;
end
在存储过程的最后加个order by stopCount asc;