Hi All,
I'm looking to query a hierarchical table that i have written, that has a format like this:
I have a second table that references the above, and people can select the lower level identified above as GrandChild1/2/3 etc.
What i need to be able to do, is to get a count of how many times the lower level items appear within the other table, and group them by their parent.
so if items, 3,4 and 5 appear in the other table 2,5 and 6 times respectively, i want to be able to present ParentOffence1 (13) and so on down the list. I've seen the FAQ here: but to be honest can't make much sense of it.
Can anyone help out?
Thanks
Tony
I'm looking to query a hierarchical table that i have written, that has a format like this:
Code:
OffenceID ParentID OffenceName
1 0 ParentOffence1
2 1 ChildOffence1
3 2 GrandChild1
4 2 GrandChild2
5 2 GrandChild3
6 0 ParentOffence2
7 6 ChildOffence2
8 7 GrandChild4
9 7 Childoffence3
10 9 GrandChild5
I have a second table that references the above, and people can select the lower level identified above as GrandChild1/2/3 etc.
What i need to be able to do, is to get a count of how many times the lower level items appear within the other table, and group them by their parent.
so if items, 3,4 and 5 appear in the other table 2,5 and 6 times respectively, i want to be able to present ParentOffence1 (13) and so on down the list. I've seen the FAQ here: but to be honest can't make much sense of it.
Can anyone help out?
Thanks
Tony