Recursive Query: Best Way

I have this recursive query in Postgres SQL:




WITH RECURSIVE mylist(id,parent_id,title,created,last_modified) AS 

    (SELECT id,parent_id,title,created,last_modified FROM Content WHERE id=73 

     UNION 

         SELECT child.id,child.parent_id,child.title,child.created,child.last_modified 

             FROM Content AS child, mylist AS parentMyList 

             WHERE child.parent_id=parentMyList.id) 

         SELECT * FROM mylist ORDER BY created DESC;



It selects a flat view of a list of threaded posts. Looking through the docs, I think maybe the same thing can be achieved with CActiveFinder, but I’m not sure. My goal is to produce a single list of threaded data, sorted chronologically, including all descendents in a tree.

Any suggestions on the best way to do this properly with Yii?

As usual, thanks for the kind help!

Seems there is a call for CActiveTreeView…