how to populate treeview from multiple columns of sql data table

I have attached my sql table here.from that table,i have to populate a treeview of the below form;

-outlook
---------overcast
-----------------------------yes
---------rainy
----------------wind
----------------------strong
------------------------------no
----------------------weak
-------------------------------yes
---------sunny
---------------humidity
------------------------high
--------------------------------no
-------------------------normal
---------------------------------yes.


It is readable like this;
if outlook is overcast then yes
if outlook is rainy and if wind is strong then no
if outlook is rainy and wind is weak then yes
if outlook is sunny and humidity is high then no
if outlook is sunny and humidity is normal then yes


how can i use this table to populate treeview.

You can do it in a query which uses 3 left joins to connect from the highest to the lower levels of the hierarchy. But this is not a general solution as the hierarchy can - in principle - be arbitrarily deeply nested. Therefore you will need a prodedure to build a general tree view model - either in an external procedural language like PHP or, preferably, in MySQL itself.

commented: agree +13

You can do it in a query which uses 3 left joins to connect from the highest to the lower levels of the hierarchy. But this is not a general solution as the hierarchy can - in principle - be arbitrarily deeply nested. Therefore you will need a prodedure to build a general tree view model - either in an external procedural language like PHP or, preferably, in MySQL itself.

can you please explain sir....I am a beginner in sql...

As smantscheff mentioned you need to pull the records from DB by using joins between your dependent tables. Better to use some external tool to populate the tree.