プログラマーとプログラミングに熱心な人々のための質問と回答
declare @T table ( EmpId char(3), X int, Y int ) insert into @T select 'U27', 1, 1 union all select 'U28', 1, 2 union all select 'U29', 1, 3 union all select 'U30', 2, 1 union all select 'U31', 2, 2 union all select 'U32', 2, 3 union all select 'U33', 3, 1 union all select 'U34', 3, 2 union all select 'U35', 3, 3 select [1], [2], [3] from @T pivot (min(EmpId) for Y in ([1], [2], [3])) as p