Tricky discussion about how to returnt resultsets. Looking for opions :)

Tricky discussion about how to returnt resultsets. Looking for opions :)

Old forum URL: forums.lhotka.net/forums/t/697.aspx


RangerGuy posted on Friday, July 21, 2006

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 SET
Groupid 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

david.wendelken replied on Friday, July 21, 2006

Is this a one level deep structure, or is it an n-level hierarchichal structure?

 

chriss replied on Friday, July 21, 2006

As long as the grouping table is well indexed or reasonably small i'd suggest that ther performance difference would be insignificant.

RangerGuy replied on Friday, July 21, 2006

The table is N-Level.

So basically comes down to personal preference then?

Copyright (c) Marimer LLC