Look up PIVOT operator.You will need something like thisdeclare @t table (number varchar(10), xref_number varchar(10))insert @tselect 'S123','343M' union allselect 'S123','455M' union allselect 'S123','501M' union allselect 'S123','615M' union allselect 'S123','999M' union allselect 'S234','343M' union allselect 'S234','455M' union allselect 'S234','501M' union all--select 'S234','615M' union allselect 'S234','999M'SELECT number, [343M] AS Xref1, [455M] AS Xref2, [501M] AS Xref3, [615M] AS Xref4, [999M] AS Xref5FROM (SELECT * from @t ) pPIVOT(MAX (xref_number)FOR xref_number IN( [343M], [455M], [501M], [615M], [999M] )) AS pvtorder by number