0

階層クエリに問題があります。次のクエリは Oracle では機能しますが、DB2 では機能しません

シカゴから旅を始めた場合に可能な目的地を検索します..

SELECT   origin, departure, arrival
FROM  schema001."FLIGHTS"
START WITH departure = 'Chicago'
CONNECT BY PRIOR arrival = departure;

DB2でクエリを作成するにはどうすればよいですか?

よろしくお願いします

4

3 に答える 3

1

Cheers.... I got the solution, Working solution is ....

WITH rajesh(departure, arrival) AS 
(
select departure, arrival from ALERTS_TEST.flights where departure = 'Chicago'
    UNION ALL
select nplus1.departure, nplus1.arrival  from ALERTS_TEST.flights as nplus1, rajesh
    WHERE rajesh.arrival = nplus1.departure
) 
SELECT departure, arrival FROM rajesh;

I have checked the above query in db2 v9.7 and sqlserver 2005. It's working fine... Thanks for ur help a_horse_with_no_name

于 2013-04-24T10:09:44.300 に答える