Given a simple data structure:
ID | Category_Name | Parent_ID
Example:
1 Cars 0 2 Boxes 0 3 Lamborghinis 1 4 VW Camper Vans 1 5 Big Boxes 2 6 Small Boxes 2 7 Cereal Boxes 2 8 Broken Lambos 3 9 Yellow Ones 3 10 Rusty 8 11 Milkshake Stained 8 12 Chocolate Flavour 11 13 Strawberry 11 14 Indiscernible Solution 11
Introducing a simple tree navigation structure, what would be the software best way to get a tree in a presentable format? Can we create an SQL statement to "order" them?
Thanks for any help! If my approach is wrong, feel free to comment as well.
I am using SQL-Server 2000.
sql sql-server database-design tree
Tom gullen
source share