select identity(int,1,1) as row ,* into #A from test where id = 'A' select identity(int,1,1) as row ,* into #B from test where id = 'B' select identity(int,1,1) as row ,* into #C from test where id = 'C'select A.row, A.value, B.value, C.value from #A as A left join #B as B on A.row = B.row left join #C as C on A.row = C.row
select identity(int,1,1) as row ,* into #B from test where id = 'B'
select identity(int,1,1) as row ,* into #C from test where id = 'C'select A.row, A.value, B.value, C.value from #A as A
left join #B as B on A.row = B.row
left join #C as C on A.row = C.row