Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Onamuji
Aged Yak Warrior
504 Posts |
Posted - 2001-07-16 : 14:06:16
|
| First off the old schema:------------------------------------------------------------TableA - Id - Name TableB - Id - TableA_Id - Name TableC - Id - TableA_Id - Other_Data------------------------------------------------------------Now the desired schema------------------------------------------------------------TableA - Id - NameTableB - Id - ParentId - TableA_Id - NameTableC - Id - TableA_Id - Other_Data------------------------------------------------------------Small change to get a hierarchical design... however...TableB.TableA_Id can be included many times... I was doinga simple set of joins that would create a report of TableC.Other_Data and group it by TableB.Name and link thosethrough TableC.TableA_Id and TableA.Id ... and back toTableB.TableA_Id ... it worked perfectly, but now thatTableB.TableA_Id can be a child of TableB through theParentId, I have multiple inclusions of TableC.Other_Data. Does anyone know how to solve this? I have yet to come up with a way of including all items from TableB but notincluding items that have children.... some items in TableBwill have children items, others will not... In addition: Example name hierarchical name content: Entry A Entry B Entry C - Child Entry A - Child Entry B Entry D Entry E - Child Entry A Entry F Entry C may point to TableA.Id say 5, and the child entry for Entry C, Child Entry A may also point to TableA.Id 5... I don't want to include Entry C at all if it has a child entry taht points to TableA.Id that is the same id as itself.... Hope that makes it a little more clear...Regards,AdamThanks in advance,AdamEdited by - onamuji on 07/16/2001 14:11:16 |
|
|
|
|
|