Thank you. I was trying too long to do this in SQL. > -----Oryginalna wiadomość----- > Od: Dan Nelson [mailto:[EMAIL PROTECTED]] > Wysłano: 22 października 2001 23:38 > Do: Daniel _a_ > DW: Lista MySQL > Temat: Re: Tree in SQL > > > In the last episode (Oct 22), Daniel _a_ said: > > I have a table in database which describes tree structure of > article groups. > > In this table I have: > > 1. group_id - group identifier > > 2. parent_group_id - identifier of parent group > > I need to select history, from top to wanted group. > > I can't change the database design and ofcourse this is MySQL > 3.23 database. > > Can somebody help me ? > > You'll have to do multiple selects. Loop: > > select parent_group_id from table where group_id = :myid > :myid = parent_group_id > > Stop when myid == the ID of the top of the tree. > > -- > Dan Nelson > [EMAIL PROTECTED] >
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php