select a.a1,a.a2,(case when isnull(a.a3,0)<>0 then c.c2
                       when isnull(a.a3,0)==0 then b.b2 end) as xxx
    into abc
    form a,b,c

解决方案 »

  1.   

    select a.a1,a.a2,(case when isnull(a.a3,0)<>0 then c.c2
                           when isnull(a.a3,0)=0 then b.b2 else 0 end) as xxx
        into abc
        from a,b,c
      

  2.   

    select a.a1,a.a2,(case when isnull(a.a3,0)<>0 then c.c2
                           when isnull(a.a3,0)=0 then b.b2 end) as xxx
        into abc
        from a,b,c
      

  3.   

    a b c 之间的关系是什么
      

  4.   

    a.a1 同 b.b1关联,a.a2,同c.c1关联呀我只是想把a表的记录into到一个表里,建立一个新的列,这个列就是上面的条件所产生的结果。。多谢
      

  5.   

    select a.a1,a.a2,(case when isnull(a.a3,0)<>0 then c.c2
                           when isnull(a.a3,0)=0 then b.b2 end) as xxx
        into abc
        from a,b,c
    ----------------------
    增加下面得条件:
    where a.a1 = b.b1 and a.a2 = c.c1
      

  6.   

    insert into abc select a.a1,a.a2,(case when isnull(a.a3,0)<>0 then c.c2 when isnull(a.a3,0)=0 then b.b2 end) as xxx from a,b,c
      

  7.   

    select a.a1,a.a2,(case when isnull(a.a3,0)<>0 then c.c2
                           when isnull(a.a3,0)=0 then b.b2 end) as xxx
        into abc
        from a,b,c
        where a.a1 = b.b1 and a.a2 = c.c1