﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Teradata Forums / Teradata  / Teradata Database  / Teradata Recursive SQL / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>Teradata Forums</description><link>http://www.teradata.com/teradataforum/</link><webMaster>info@teradata.com</webMaster><lastBuildDate>Sat, 06 Sep 2008 12:57:58 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Teradata Recursive SQL</title><link>http://www.teradata.com/teradataforum/Topic11379-9-1.aspx</link><description>I haven't tested... but something like this should work ...WITH RECURSIVE RECTBL(CHLD, PRNT, LVL)AS(  SELECT CHILD, PARENT, 1(INTEGER)  FROM MYTBL  WHERE CHILD = 'G'  UNION ALL  SELECT MYTBL.CHILD, MYTBL.PARENT, RECTBL.LVL + 1  FROM RECTBL INNER JOIN MYTBL  ON RECTBL.PRNT = MYTBL.CHILD  AND RECTBL.LVL &amp;lt;= 5  )SELECT CHLD, PRNTFROM RECTBLORDER BY LVL;</description><pubDate>Thu, 08 May 2008 02:01:25 GMT</pubDate><dc:creator>joedsilva</dc:creator></item><item><title>Teradata Recursive SQL</title><link>http://www.teradata.com/teradataforum/Topic11379-9-1.aspx</link><description>Hi All,I'm new to teradata and your help here would be greatly appreaciated.I need a recursive SQL to find the child-parent relationship in a table.For example,Child      ParentB              AC              BD              BG              CJ               ANow i need to recursively find out the parents until a node does not have any parents(I need to do this search recursively for 5 levels)For instance,If i want to trace the parent of child G...it must be like G--&amp;gt;C--&amp;gt;B--&amp;gt;AIf i want to know the parent of G,it must traverse like D--&amp;gt;B--&amp;gt;A.Regards,Kumar</description><pubDate>Thu, 08 May 2008 01:02:06 GMT</pubDate><dc:creator>kumar</dc:creator></item></channel></rss>