BeachSandGuy
Programmer
Hi, I have been searching and have been unable to find a solution to the following.
I have multiple tables, here are some examples.
t1
Policy Name EffDate
1 Walmart 1/1/09
2 Target 1/1/09
t2
Policy Phone Type
1 8005555551 1
1 8005555552 2
2 8005555553 1
2 8005555554 2
2 8005555555 3
t3
Type Description
1 Products
2 Restaurant
3 Vision
I can join the tables together to get the following:
Select t1.Policy, t1.Name, t2.Phone, t3.Description
From t1
Left outer join t2 on t1.Policy = t2.Policy
Left outer join t3 on t2.Type = t3.Type
Results would be:
1 | Walmart | 8008555551 | Products
1 | Walmart | 8008555552 | Restaurant
2 | Target | 8008555553 | Products
2 | Target | 8008555554 | Restaurant
2 | Target | 8008555555 | Vision
How could I do this so that the results would be the following with one client per line?
1 | Walmart | 8008555551 | Products | 8008555552 | Restaurant
2 | Target | 8008555553 | Products | 8008555554 | Restaurant | 8008555555 | Vision
Just a note I have multiple tables that I'd combine together, so for example, might be another for manually entered volumes per department. None of this is aggregated though, so just straight data, no need to sum or perform calculation on any of it.
Thanks in advance for any assistance.
Ian
I have multiple tables, here are some examples.
t1
Policy Name EffDate
1 Walmart 1/1/09
2 Target 1/1/09
t2
Policy Phone Type
1 8005555551 1
1 8005555552 2
2 8005555553 1
2 8005555554 2
2 8005555555 3
t3
Type Description
1 Products
2 Restaurant
3 Vision
I can join the tables together to get the following:
Select t1.Policy, t1.Name, t2.Phone, t3.Description
From t1
Left outer join t2 on t1.Policy = t2.Policy
Left outer join t3 on t2.Type = t3.Type
Results would be:
1 | Walmart | 8008555551 | Products
1 | Walmart | 8008555552 | Restaurant
2 | Target | 8008555553 | Products
2 | Target | 8008555554 | Restaurant
2 | Target | 8008555555 | Vision
How could I do this so that the results would be the following with one client per line?
1 | Walmart | 8008555551 | Products | 8008555552 | Restaurant
2 | Target | 8008555553 | Products | 8008555554 | Restaurant | 8008555555 | Vision
Just a note I have multiple tables that I'd combine together, so for example, might be another for manually entered volumes per department. None of this is aggregated though, so just straight data, no need to sum or perform calculation on any of it.
Thanks in advance for any assistance.
Ian