Hi;<br>I have the following code:<br>  sql = 'create table if not exists categories (ID int(3) unsigned primary key, Category varchar(40), Parent varchar(40))'<br>  cursor.execute(sql)<br>  cursor.execute('select Category, Parent from categories;')<br>
  data = cursor.fetchall()<br>  parents = []<br>  Parents = []<br>  for dat in data:<br>    if dat[1] not in parents:<br>      parents.append(dat[1])<br>    Categories.append(dat[0])<br>    Parents.append(dat[1])<br>  Parents.sort()<br>
  families = []<br>  for parent in Parents:<br>    children = []<br>    for dat in data:<br>      if dat[0] == parent:<br>        children.append(dat[1])<br>    families.append([parent, children])<br><br>Now, what I want to do is to capture all nested categories, such that if x is the parent of y who is the parent of z, etc., I can print out the entire family tree. I'm at a loss as to how to do it! Please advise.<br>
TIA,<br>Victor<br><br>