2 added 40 characters in body
source | link

Using the CONNECT BY syntax (similar to Oracle's) which allows recursive queries:

select connect_by_root parent as ancestor, 
       child
from x                            -- table name
connect by prior child = parent
order siblings by parent ;

Tested in rextester.com

Using the CONNECT BY syntax (similar to Oracle's) which allows recursive queries:

select connect_by_root parent as ancestor, 
       child
from x 
connect by prior child = parent
order siblings by parent ;

Tested in rextester.com

Using the CONNECT BY syntax (similar to Oracle's) which allows recursive queries:

select connect_by_root parent as ancestor, 
       child
from x                            -- table name
connect by prior child = parent
order siblings by parent ;

Tested in rextester.com

1
source | link

Using the CONNECT BY syntax (similar to Oracle's) which allows recursive queries:

select connect_by_root parent as ancestor, 
       child
from x 
connect by prior child = parent
order siblings by parent ;

Tested in rextester.com