The simplest way to explain would be to give an example.
Say I have a set of database tables like this:
Person(SSN, DOB)
Alias(SSN, FirstName, LastName)
Address(SSN, Street, City, State)
Phone(SSN, PhoneNum)
Skill(SSN, SkillDescription)
There's one person with a particular SSN and that person can have many aliases, addresses, phone numbers, and skills.
Then I have a form that allows users to search for people. For instance, find all the people in the database that live in Chicago. Currently I have a query that ends up looking like this:
Select * from
Person Pe
left join Alias Al on Pe.SSN = Al.SSN
left join Address Ad on Pe.SSN = Ad.SSN
left join Phone Ph on Pe.SSN = Ph.SSN
left join Skills Sk on Pe.SSN = Sk.SSN
where Pe.SSN in
(select SSN from Address where City = 'Chicago')
And I'm basically just displaying the results of this query on my form in a datagrid. This works and gives the user all the data they need, but it's confusing because the result of the joins can produce a lot of records if the people that are found have multiple records in each of the other tables. As a simple example, if 2 people are found and they each have 2 aliases, 2 addresses, 2 phone numbers, and 5 skills, the user will see 80 records.
I guess this is a general question on displaying data with many to one relationships. I'm not sure how to go about displaying this kind of data. Clearly, a simple datagrid isn't the best way, but I'm not sure how else to do it.
Say I have a set of database tables like this:
Person(SSN, DOB)
Alias(SSN, FirstName, LastName)
Address(SSN, Street, City, State)
Phone(SSN, PhoneNum)
Skill(SSN, SkillDescription)
There's one person with a particular SSN and that person can have many aliases, addresses, phone numbers, and skills.
Then I have a form that allows users to search for people. For instance, find all the people in the database that live in Chicago. Currently I have a query that ends up looking like this:
Select * from
Person Pe
left join Alias Al on Pe.SSN = Al.SSN
left join Address Ad on Pe.SSN = Ad.SSN
left join Phone Ph on Pe.SSN = Ph.SSN
left join Skills Sk on Pe.SSN = Sk.SSN
where Pe.SSN in
(select SSN from Address where City = 'Chicago')
And I'm basically just displaying the results of this query on my form in a datagrid. This works and gives the user all the data they need, but it's confusing because the result of the joins can produce a lot of records if the people that are found have multiple records in each of the other tables. As a simple example, if 2 people are found and they each have 2 aliases, 2 addresses, 2 phone numbers, and 5 skills, the user will see 80 records.
I guess this is a general question on displaying data with many to one relationships. I'm not sure how to go about displaying this kind of data. Clearly, a simple datagrid isn't the best way, but I'm not sure how else to do it.