DK
Size: a a a
DK
ST
P
with recursive build_path as
( select flights.from,flights.to,concat(flights.from,',',flights.to) as current_path, 0 as cross_point,duration from flights where 1
union all
select flights.from as `from`, build_path.to as `to`,concat(flights.from,',',build_path.current_path)
as current_path,1+build_path.cross_point as cross_point ,flights.duration+build_path.duration as duration from flights, build_path
where flights.to =build_path.from and `cross_point`<=4 and not find_in_set(flights.from,build_path.current_path) )
select * from build_path where `from`='kh' and `to`='van' order by duration limit 1;
ST
DK
P
P
P
P
VM
TB
VG
P
MA
VG
TB
VG
AK
SM
E