PDA

View Full Version : Query Multiple Levels Deep


dprichard
07-31-2007, 07:31 PM
I have a database with a table for folders that can have subfolders. It is setup like this

FolderID
FolderName
SubFolderID

If the user puts something in the main folder it is given a SubFolderID of 1. Anything else is given a SubFolderID of whatever folder it goes into.

They can put documents into each of these folders and they are saved in a document table.

DocumentID
DocumentName
DocumentFolderID

I am trying to figure out how I can have a query for just the main level of documents that shows the number of documents under that category going all the way down into the sub folders. Since the sub folders can potentially go down infinitely, I am having a little trouble figuring out how to do this. Any help would be GREATLY appreciated.

Thank you!!!!!!!!!!!!!!!!!!!!!!