I am using SQL Server 2005, I have a single table called Docs
with a single column called Path
.
Path
column contains file paths:
"C:\MyDocs\1.txt"
"C:\MyDocs\Folder1\3.txt"
I need my query to retrieve in a single query how many children each folder and subfolder has.
In my example above I need the query to retrieve:
3 children (1 folder and 2 files) for "MyDocs" 1 child (1 file) for "Folder1".
Any ideas?
Thank you.