Here is an example of how you can do it using PIVOT. You need to be on SQL 2005 or higher to be able to use this:CREATE TABLE #tmp (loan_no INT, phone_no INT);INSERT INTO #tmp SELECT 1,1234 UNION ALLSELECT 1,4566 UNION ALL SELECT 2,5566 UNION ALL SELECT 2,6566 UNION ALL SELECT 2,7566;WITH cte AS( SELECT *,ROW_NUMBER() OVER (PARTITION BY loan_no ORDER BY phone_no) AS RN FROM #tmp)SELECT *FROM ctePIVOT( MAX(phone_no) FOR RN IN([1],[2],[3],[4],[5])) P