0

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.

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by debasisdas
1

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.

Votes + Comments
agree
0

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

0

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.

Edited by debasisdas: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.