Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
the purpose is to retrieve the whole tree from adjacent-list table with depth as an parameter.SELECT t1.name AS lev1,t2.name AS lev2,t3.name AS lev3 FROM tab AS t1 LEFT JOIN tab AS t2 ON t2.parentID = t1.ID LEFT JOIN tab AS t3 ON t3.parentID = t2.ID WHERE t1.parentID = 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: generate self join sql with specified depth level
by suaveant (Parson) on Dec 22, 2009 at 14:59 UTC |