Q
qqcoisa
Guest
Greetings,
I want to create a database with data stored in a directory/geneology kind of structure. I was thinking in a solution like this:
Table A (and sample data):
Field ID_Person ( 1 , 2 , 3 , 4 , 5 )
Field Person (mary , jane , carl , bob , carmen)
Table B (and sample data):
Field Parent ( 1 , 1 , 1 , 4 )
Field Children ( 2 , 3 , 4 , 5 )
Table C (and sample data):
Field Car (1)
Field Licence Plate (12-34-AB)
Field Owner (3)
This tables let me know everything I want. I know mary is the mother of jane, carl, and bob. And that bob is the father of carmen. So, for each person I can easly see their children, and parents (if instead of relating ID_Person with Parent, I relate ID_Person with Children)
I'm using access and when I create the relationship ID_Person to Parent, I go to table A and by pressing the "plus button" all is fine:
Table A
- 1 mary
2
3
4
+ 2 jane
+ 3 carl
+ 4 bob
+ 5 carmen
However, I want to see the names of the children of mary, and also their own children if any, like this:
Table A
- 1 mary
+ 2 jane
+ 3 carl
- 4 bob
+ 5 carmen
+ 2 jane
+ 3 carl
+ 4 bob
+ 5 carmen
But when I add the relationship ID_Person to children it stops working.
If I add to table A the field "ID_Person2" with the same values of "ID_Person"
and then create the relationships: "ID_Person to parent" and "ID person2 to children (now primary key)", I get the above structure as I itended.
But having two fields with the same value is very very ugly, so I would like to avoid that, but dont know how. Furthermore, I can't make children primary because a children has two parents, therefore, colum children will hold duplicate values).
Thanks Beforehand,
Pedro Vaz
(if it changes anything, please assume a children may have any number of parents. I want to adapt this structure to other contexts without parents=2 restriction)
I want to create a database with data stored in a directory/geneology kind of structure. I was thinking in a solution like this:
Table A (and sample data):
Field ID_Person ( 1 , 2 , 3 , 4 , 5 )
Field Person (mary , jane , carl , bob , carmen)
Table B (and sample data):
Field Parent ( 1 , 1 , 1 , 4 )
Field Children ( 2 , 3 , 4 , 5 )
Table C (and sample data):
Field Car (1)
Field Licence Plate (12-34-AB)
Field Owner (3)
This tables let me know everything I want. I know mary is the mother of jane, carl, and bob. And that bob is the father of carmen. So, for each person I can easly see their children, and parents (if instead of relating ID_Person with Parent, I relate ID_Person with Children)
I'm using access and when I create the relationship ID_Person to Parent, I go to table A and by pressing the "plus button" all is fine:
Table A
- 1 mary
2
3
4
+ 2 jane
+ 3 carl
+ 4 bob
+ 5 carmen
However, I want to see the names of the children of mary, and also their own children if any, like this:
Table A
- 1 mary
+ 2 jane
+ 3 carl
- 4 bob
+ 5 carmen
+ 2 jane
+ 3 carl
+ 4 bob
+ 5 carmen
But when I add the relationship ID_Person to children it stops working.
If I add to table A the field "ID_Person2" with the same values of "ID_Person"
and then create the relationships: "ID_Person to parent" and "ID person2 to children (now primary key)", I get the above structure as I itended.
But having two fields with the same value is very very ugly, so I would like to avoid that, but dont know how. Furthermore, I can't make children primary because a children has two parents, therefore, colum children will hold duplicate values).
Thanks Beforehand,
Pedro Vaz
(if it changes anything, please assume a children may have any number of parents. I want to adapt this structure to other contexts without parents=2 restriction)