Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: Pedigree database

    I want to write an online database that displays 4-generation pedigrees. Can anyone point me to a tutorial/web site on how to do this? I've written several online databases in asp, but can't figure out how to do this particular algorithm. Any help appreciated.

    Basically I have a list of about 400,000 horses each with a unique ID code. In each individual horse’s record there is its mother and father identified by their ID codes. ie; three columns, the horse's ID, and it's mother and father's ID. So, when you display a horse’s four generation chart, it should all link up…horse, mother father, grandparents, great-grandparents etc.. It should be a common database task, but I’ve searched everywhere on the web and in various books and can’t find how to write and link up the SQL statements. Any help/pointers would be appreciated. cheers

  2. #2
    Join Date
    Jan 2004
    Your table design should be similar to the following:

    Horse Id,Horse Detail,Fathers Id, Mothers Id

    Using SELF JOIN (Relating the table to itself by aliasing) you can derive any number of elements in a hierarchy.

    e.g. Data

    Horse Id | Horse Detail | Father Id | Mother Id
    1 | ABC | |
    2 | DEF | |
    3 | GHI |1 |2
    4 | JKL |1 |2
    5 | MNO | |
    6 | PQR |1 |5

    An addtional field Sex (F/M) may be useful for your application

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts