Subject | Recursive Query |
---|---|
Author | Uwe Oeder |
Post date | 2003-11-13T12:24:12Z |
I would like to query a recursive table but am not getting the child
records. The table looks like the following : Tbl (ID : Integer , Link :
Integer , Name : Char) My SQL Query looks as follows but only returns the
parent record. The Link field references the ID field and determines who is
the parent record.
SELECT T1.Name
FROM Tbl T1 LEFT OUTER JOIN Tbl T2 ON (T1.ID = T2.Link)
WHERE T1.Name LIKE 'ZAR%';
I would like to query multiple levels , can somebody show me what I am
doing wrong. Also is it possible given a condition like this to find all
Parents records upwards in the hierachy ?
records. The table looks like the following : Tbl (ID : Integer , Link :
Integer , Name : Char) My SQL Query looks as follows but only returns the
parent record. The Link field references the ID field and determines who is
the parent record.
SELECT T1.Name
FROM Tbl T1 LEFT OUTER JOIN Tbl T2 ON (T1.ID = T2.Link)
WHERE T1.Name LIKE 'ZAR%';
I would like to query multiple levels , can somebody show me what I am
doing wrong. Also is it possible given a condition like this to find all
Parents records upwards in the hierachy ?