If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Pedigree database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-03, 06:22
tbvillage tbvillage is offline
Registered User
 
Join Date: Nov 2003
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 01-10-04, 04:14
tvkoottunkal tvkoottunkal is offline
Registered User
 
Join Date: Jan 2004
Posts: 1
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On