Ok we have grouping table like so. With the following data
Groupid | ParentID | ChildID | ParentSortOrder | ChildSortOrder |
1 | 1 | 1 | 1 | 1 |
1 | 1 | 2 | 1 | 2 |
1 | 1 | 3 | 1 | 3 |
2 | 1 | 1 | 1 | 1 |
2 | 2 | 1 | 1 | 2 |
My partner likes to return the data like so. So we only have to join to the grouping table once.
Groupid | ParentID | ParentName | ChildID | ChildName | ParentSortOrder | ChildSortOrder |
1 | 1 | Parent 1 | 1 | Child 1 | 1 | 1 |
1 | 1 | Parent 1 | 1 | Child 2 | 1 | 2 |
1 | 2 | Parent 2 | 1 | Child 1 | 1 | 2 |
1 | 2 | Parent 2 | 2 | Child 2 | 1 | 2 |
I prefer to have 2 resultsets returned like so. But what I'm concerned with is have to join to the grouping table twice to build these results. So were looking for votes on which way is preferred.
PARENT RESULT SETGroupid | ParentID | ParentName | ParentSortOrder |
1 | 1 | Parent 1 | 1 |
1 | 2 | Parent 2 | 2 |
CHILD RESULT SET
ParentID | ChildID | ChildName | ParentSortOrder | ChildSortOrder |
1 | 1 | Child 1 | 1 | 1 |
1 | 2 | Child 2 | 1 | 2 |
1 | 3 | Child 3 | 1 | 3 |
2 | 1 | Child 1 | 1 | 1 |
2 | 2 | Child 2 | 1 | 2 |
2 | 3 | Child 3 | 1 | 3 |
Is this a one level deep structure, or is it an n-level hierarchichal structure?
The table is N-Level.
So basically comes down to personal preference then?
Copyright (c) Marimer LLC