create table Phones (Name varchar(50), PhoneTypeID int, PhoneNum varchar(25)) GO insert into Phones values ('Kevin Goff', 1, '555-1212') insert into Phones values ('Kevin Goff', 2, '555-9912') insert into Phones values ('Kevin Goff', 3, '555-8803') insert into Phones values ('Katy Goff', 1, '777-3923') insert into Phones values ('Katy Goff', 2, '777-0133') insert into Phones values ('Katy Goff', 3, '777-9845') insert into Phones values ('Katy Goff', 4, '777-0203') insert into Phones values ('Mike Smith', 1, '888-9090') insert into Phones values ('Mike Smith', 5, '812-1023') insert into Phones values ('Ron Wilson', 1, '929-0133') insert into Phones values ('Ron Wilson', 6, '856-9988')Then here is a PIVOT statement. Most people think of PIVOT as something for dollars, but you can also use it to create columns based on text data as well.
select Name, [1] as [Home], [2] as Office, [3] as Fax, [4] as Cell, [5] as [Other1], [6] as [Other2], [7] as [Other3] from Phones PIVOT ( MIN(PhoneNum) for PhoneTypeID in ([1], [2], [3], [4], [5], [6], [7])) TempListNow, there's one thing about PIVOT....you can't (at least to my knowledge) "dynamically" build the columns with the names from your phone type table. (Unless you generate the query using dynamic SQL). PIVOT is static in that sense...but hopefully this should help you. You'll need to adapt it to your situation, but it should be a start.