http://expert.csdn.net/Expert/topic/1620/1620620.xml?temp=.5749018

解决方案 »

  1.   

    这用 SQL 语句写不出来的吧,只能自己去写代码的吧
      

  2.   

    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