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.
|