Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 20 Sep 2004 @ 20:50:08 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: CONNECT BY ..START WITH ( Equivalent in Teradata )
 
From:   Walter, Todd A

It is in V2R6.0. Not with START/CONNECT BY syntax because ANSI did it with different syntax.

     WITH RECURSIVE All_Trips(Source, Destination,Cost, Depth) AS
     (
       SELECT Source, Destination, Cost, 0 FROM Flights
       UNION ALL
       SELECT All_Trips.Source,
              Flights.Destination,
              All_Trips.Cost + Flights.cost,
              All_Trips.Depth + 1
         FROM All_Trips, Flights /*Recursive reference*/
           WHERE All_Trips.Destination = Flights.Source
     )
     SELECT * FROM All_Trips;


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023