Hi !

There is any way to have hierarchical list with Mysql, like the Oracle
START WITH and CONNECT BY ?


Something like :

     CREATE TABLE links_categories (
       id int(11) NOT NULL auto_increment,
       parent int(11) default NULL,
       libelle varchar(50) default NULL,
       PRIMARY KEY  (id)
     )  ;

The Oracle syntax is :

    SELECT id, parent, libelle FROM links_categories
      CONNECT BY parent = PRIOR  START WITH parent = 2

In fact, I need to select "all the links categories witch are the son
of 2, sons of the sons of 2, and so on..."

  SELECT  id, parent, libelle
  FROM links_categories
  WHERE (id = 2 or parent = 2)

Works for the father and the son, but for the others... :(

A +

-- 
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
      Richard CARLIER                          http://www.rcarlier.net
 (o_    - Votre association et Internet (mai 2002, VMP, 2-7440-6013-5)
 //\    - Profession Webmaster (nov. 2000, Les Echos, 2-84211-112-5)
 V_/_   - Cocktails, boissons (http://www.atontour.com)
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to