Possible Duplicate:
Pivot Table With 3 tables
EDIT: Sorry, I got one of the columns wrong
I have the following tables:
_______________________________________
| ItemID | ItemName | ItemDescription |
|________|__________|_________________|
| 1 | Alice | Foo |
|________|__________|_________________|
| 2 | Bob | Bar |
|________|__________|_________________|
________________________
| LinkID | LinkAddress |
|________|_____________|
| 1 | www.c.com |
|________|_____________|
| 2 | www.b.com |
|________|_____________|
| 3 | www.a.com |
|________|_____________|
________________________________________
| AssocID | ItemID | LinkID | LinkType |
|_________|________|________|__________|
| 1 | 1 | 3 | Youtube |
|_________|________|________|__________|
| 2 | 2 | 2 | Facebook |
|_________|________|________|__________|
| 3 | 2 | 1 | Twitter |
|_________|________|________|__________|
I am trying to get a SQL Query to create a result like this:
__________________________________________________________________
| ItemName | ItemDescription | Youtube | Facebook | Twitter |
|__________|_________________|___________|___________|___________|
| Alice | Foo | NULL | NULL | www.a.com |
|__________|_________________|___________|___________|___________|
| Bob | Bar | www.c.com | www.b.com | NULL |
|__________|_________________|___________|___________|___________|
Is this possible?