Non si puo fare?
Allora non capisco quest'articolo ....
ho trovato hierarchical data
Finding all the Leaf Nodes
We can find all the leaf nodes in our tree (those with no children) by using a LEFT JOIN query:
SELECT t1.name FROM
category AS t1 LEFT JOIN category as t2
ON t1.category_id = t2.parent
WHERE t2.category_id IS NULL;
+--------------+
| name |
+--------------+
| TUBE |
| LCD |
| PLASMA |
| FLASH |
| CD PLAYERS |
| 2 WAY RADIOS |
Con la loro tabella funziona.....
Ho provato ad adattarlo alla mia....ma non funziona.....
Codice PHP:
SELECT t1.name, t1.descrizione,t1.prezzo FROM
tree_elements AS t1 LEFT JOIN tree_elements as t2
ON t1.Id = t2.ownerEl
WHERE t2.Id =mio id di partenza;