有3条语句:
select A as 列1 from Tab where 条件1;
select A as 列2 from Tab where 条件2;
select A as 列3 from  Tab where 条件3;
怎样把这3个列放到一个结果呢?列1
a
b列2
c
d
e列3
e
f需要的结果是:
列1   列2      列3
a        c         e
b        d         f
(null)    e         (null)

解决方案 »

  1.   


    创造关联条件吧
    2005 row_number
    2000 临时表自增列
      

  2.   

    格式乱了,需要的结果是:
    需要的结果是:
    列1   列2    列3
    a       c      e
    b       d      f
    (null)  e      (null)
    二楼,可以给出详细点的方法吗 谢谢
      

  3.   

    列1   列2   列3
    a       c     e
    b       d     f
    (null) e     (null)
      

  4.   

    select * from tab 他们是同一个表就可以了
      

  5.   

    select id=identity(int,1,1),* into #a from a
    select id=identity(int,1,1),* into #a from b
    select id=identity(int,1,1),* into #a from c
    select
      a.列1,b.列2,c.列3
    from
      #a a left join #b b on a.id=b.id left join #c c on a.id=c.id
      

  6.   

    select A as a, B as b, C as c from Tab where 条件一 and 条件二 and 条件三 
      

  7.   

    select a.A as 列1,b.A as 列2,c.A as 列3 From Tab a,Tab b,Tab c where 条件1 and 条件2 and 条件3
    当然条件1 对 a ,条件2对b,条件3对c