nested sql & msaccess
Discussion
say i've got an ms access table like this...
Id (AutoNumber)
ParentId (Number)
Name (Text)
with the following data...
1 0 About Us
2 0 Contact Us
3 2 Contact details
4 2 Contact form
5 0 Products
is is possible to produced something like the below with a sql statement.
Level Name
0 About Us
0 Contact Us
1 Contact details
1 Contact form
0 Products
?
I can do if using a recursive function in my programming language but I'd rather do it in sql as it'll be a lot quicker.
Any advice would be much appreciated.
Id (AutoNumber)
ParentId (Number)
Name (Text)
with the following data...
1 0 About Us
2 0 Contact Us
3 2 Contact details
4 2 Contact form
5 0 Products
is is possible to produced something like the below with a sql statement.
Level Name
0 About Us
0 Contact Us
1 Contact details
1 Contact form
0 Products
?
I can do if using a recursive function in my programming language but I'd rather do it in sql as it'll be a lot quicker.
Any advice would be much appreciated.
Your data doesn't make it clear exactly what you're after, but I'm guessing you want a tree-like structure for constructing a menu (or somesuch).
This may well be possible in SQL, but it would be a complete nightmare; I'd be tempted to do it in the program that uses the data to make life easier for myself!
This may well be possible in SQL, but it would be a complete nightmare; I'd be tempted to do it in the program that uses the data to make life easier for myself!
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


