I have a table like this:
tb_objs
-------
obj_id int(10) unsigned NOT NULL AUTO_INCREMENT
obj_name varchar(45) NOT NULL
obj_parent int(10) unsigned DEFAULT NULL
It`s something like a ordered list... The first element has the 'obj_parent' = null, and the second elemente has 'obj_parent' = id of first element etc etc etc...
So, i want select all elements ordered by obj_parent... I dont know if i am cleary in what a i want... But the result has to be like this:
obj_id | obj_name | obj_parent
3 | first | null
9 | second | 3
1 | third | 9
2 | fourth | 1
4 | fifth | 2
...
etc etc etc etc
If you take a look... The object 'child' is always after his parent... It`s like a C++ ordered list...
obj_parent
obj_id <------ object_parent
obj_id <------ obj_parent
obj_id