1
Reply

Dataset Relations within the same table ... seeking advice

TechDirector

TechDirector

May 17 2004 1:22 AM
1.5k
Hello all, Pretty new to programming here, but I seem to be moving along quite well. I have a specific situation I need advice on. I'll use a hypothetical example: Let's say we have a table that holds a person's detailed information. Of course, every single unique indivual is entered into the table only once. Now, under teh columns of Mother and Father, there is a user id referenceing the respective records of the people who are the father and the mother. Here comes the question ... I fill a dataset (datset because there are other tables no mentioned in the example that need to be in there) with all the people that belong to a certain groud, for example, all of a specific teacher's students, or a doctor's patients, etc. This means that in this table, we have very likely left out the records of the parents of each of these students and/or patients. How (if it's even possible) can a relationship be establishied whitin the dataset without having to load the entire people table, which contains thousands of records? My idea was to first load the original query (a teacher's students) and the transverse the table and appending rows as each father and mother got looked up, but this seems inneficient to me with allt he checks and calls needed. Anyway, I know this is very vague, but I hope my question makes sense. I am just trying to get an idea of what the best pratice is for a scenario like this one.

Answers (1)