Discussion: Child and parent rows
Afficher un message
Vieux 26/09/2007, 12h38   #1
João Morais
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Child and parent rows

Hi there,

I have a table like the one below:

CREATE TABLE IF NOT EXISTS menuitens (
id int(11) NOT NULL auto_increment,
idMenu int(11) NOT NULL default 0,
idParent int(11) NOT NULL default 0,
PRIMARY KEY (id)
) TYPE=INNODB;

Because I will allow parent itens, I have that idParent thats
corresponds to an existing id of menuitens table, my dought is, how
can I have a query that lists all the data in the correct
order, in other words something similar to the example below:

Example:

Row1
Row2
Row2.1
Row2.2
Row2.3
Row3
Row3.1
Row4
Row5
Row6
Row6.1

Thanks in advance.

  Réponse avec citation
 
Page generated in 0,05804 seconds with 9 queries