case的应用
select (case
when (m.code_dir = 'F') then
n.code_startpointid
else
n.code_endpointid
end) as startid,
(case
when (m.code_dir = 'F') then
n.code_endpointid
else
n.code_startpointid
end) as endid
from rte_seg m, segment n
where m.segment_id = n.segment_id