how to make a working Pedigree/hierarchy all generations

Discussion in 'Databases' started by Jimmy_bra, Feb 19, 2019.

  1. #1
    The data is of dogs but i think many of the same functions apply as for a familytree of people.

    I have at table of data looking like this :
    Tags:
    Name ;Reg;Reg_Father;Father;Reg_mother ;Mother ;Born;Count
    Values:
    Prince;NO34567;NO12345;King;NO23456 ;Queen;
    2016-12-30;​
    5

    The primary key is the value "Reg" and this relates to "Reg_father" and "Reg_mother" this are all known values. "Name" is related to "Reg" in the same way "Reg_father" is to "Father" and "Reg_mother" is to "Mother"

    What i like to do is
    1. to be able to make a "familytree" and to list commen ancestors
    2. how many times these ancestors appear in the lines. Name or Reg with a count behind.

    any idees of best way to achieve this goal?

    BR
    Jimmy
     
    Last edited: Feb 19, 2019
    Jimmy_bra, Feb 19, 2019 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,807
    Likes Received:
    4,534
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I'd probably add an id field to the table and let the kennel club number be information rather than the primary key.

    1. Creating the family tree is a well document process - look for tutorials on parent_id and traversing the tree.
    2. counting how many times an ancestor appears would be a run time query and not something you save on the database.
     
    sarahk, Feb 19, 2019 IP