路线表Trace {ID,TraceName,StartCityCode,EndCityCode}
城市表City{CityCode,CityName}
select TraceName,
(select CityName from City where CityCode=StartCityCode) as StartCityName,
(select CityName from City where CityCode=EndCityCode) as EndCityName
from Trace
where ID='指定路线'
select r.roadName,c.fromName,d.toName from road r
left join city c on c.id = r.fromid
left join city d on d.id = r.toid
select cityname from city where cityid= (select go_id from path where pathid=“XX”)