I'm reading "SQL for dummies" and one of the more interesting sections 
was on recursion.  The example query was something like:

WITH RECURSIVE
   ReachableFrom (Source, Destination)
   AS (SELECT Source, Destination
      FROM FLIGHT
   UNION
   SELECT in.Source, out.Destination
      FROM ReachableFrom in, FLIGHT out
      WHERE in.Destination = out.Source
   )
SELECT * FROM ReachableFrom
WHERE Source = "Portland";

I'm a bit thrown by the union.  Can this be simplified to:


WITH RECURSIVE
   ReachableFrom (Source, Destination)
   AS (SELECT Source, Destination
      FROM FLIGHT
   )
SELECT * FROM ReachableFrom
WHERE Source = "Portland";



thanks,

Thufir


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to