Q&A for students, teachers, and linguists wanting to discuss the finer points of the Chinese language
CREATE table #yourtable ([LeadID] bigint, [ContactType] varchar(6), [ContactValue] varchar(13)) ; INSERT INTO #yourtable ([LeadID], [ContactType], [ContactValue]) VALUES (1, 'Phone', '123456789'), (1, 'Cell', '987654321'), (1, 'Email', '[email protected]'), (4, 'Cell', '123456789'), (5, 'Phone', '123456789') ; select LeadID, Phone, Cell, Email from ( select LeadId, ContactType, ContactValue from #yourtable ) d pivot ( max(ContactValue) for ContactType in (Phone, Cell, Email) ) piv;