Hi,
I have a database that is based on the nested set model. what i'm trying to do here is to run a query that gets the "leaf" nodes and it's parents. For example my table looks like this:
Code:
+-----------------------+
| name |
+-----------------------+
| ELECTRONICS |
| TELEVISIONS |
| TUBE |
| LCD |
| PLASMA |
| PORTABLE ELECTRONICS |
| MP3 PLAYERS |
| FLASH |
| CD PLAYERS |
| 2 WAY RADIOS |
+-----------------------+
I'm trying to get this....
Code:
+----------------------+-------+
| name | parent |
+----------------------+-------+
| TUBE | Television |
| LCD | Television |
| PLASMA | Television |
| FLASH | MP3 Players |
| CD PLAYERS | PORTABLE ELECTRONICS|
| 2 WAY RADIOS | PORTABLE ELECTRONICS |
+----------------------+-------+
Any help would be appreciated. Thanks in advnace!