OK, here's the issue.
Say I have 3 tables (tblEntity, tblEntityName, tblEntityAddress)
An entity represents a person. That person can have multiple names(aliases) and multiple addresses. So there is a one-to-many relationship between Entity and EntityName and a one-to-many relationship between Entity and EntityAddress. The primary key for Entity is EntityId.
So I do something like this:
Select ...
From tblEntity E
left join tblEntityName EN on E.EntityId = EN.EntityID
left join tblEntityAddress EA on E.EntityId = EA.EntityID
where E.EntityID = <some number>
This gives me all the data I need, but in the case of a person with 3 different aliases and 3 different addresses, I get 9 results back. I know this makes sense because each alias combined with each address is a unique record in the resultset. I'm currently just displaying the results of this query in a grid, but displaying the results this way is confusing to the user. What I really want to show them is that there are 3 aliases and 3 addresses associated with this particular person.
Ideally, I'd like to just combine the results. Something like a Union, but combining columns instead of rows.
Any ideas ?
Say I have 3 tables (tblEntity, tblEntityName, tblEntityAddress)
An entity represents a person. That person can have multiple names(aliases) and multiple addresses. So there is a one-to-many relationship between Entity and EntityName and a one-to-many relationship between Entity and EntityAddress. The primary key for Entity is EntityId.
So I do something like this:
Select ...
From tblEntity E
left join tblEntityName EN on E.EntityId = EN.EntityID
left join tblEntityAddress EA on E.EntityId = EA.EntityID
where E.EntityID = <some number>
This gives me all the data I need, but in the case of a person with 3 different aliases and 3 different addresses, I get 9 results back. I know this makes sense because each alias combined with each address is a unique record in the resultset. I'm currently just displaying the results of this query in a grid, but displaying the results this way is confusing to the user. What I really want to show them is that there are 3 aliases and 3 addresses associated with this particular person.
Ideally, I'd like to just combine the results. Something like a Union, but combining columns instead of rows.
Any ideas ?