Yii Framework Forum: Recursive Query: Best Way - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Recursive Query: Best Way Rate Topic: -----

#1 User is offline   queej 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 04-February 10

Posted 04 March 2010 - 10:36 AM

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!
0

#2 User is offline   DerekC 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 09-December 09
  • Location:Europe

Posted 09 April 2010 - 03:53 AM

Seems there is a call for CActiveTreeView...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users