select a,b,'' as c,'' as d from table1
union all 
select a,'' as b,c,d from table1 

解决方案 »

  1.   

    create view vi_union as
    select a,b,'' c,'' d from table1
    union all
    select a,'',c,d from table2
      

  2.   

    select isnull(a.a, b.a), a.b,  b.c, b.d from table1 a full outer join table2 b
    on a.a = b.a
      

  3.   

    create view vi_union as
    select a,b,cast('' varchar(20)) c,cast('' varchar(20)) d from table1
    union all
    select a,'',c,d from table2
      

  4.   

    create view vi_union as
    select a,b,cast('' varchar(20)) c,cast('' varchar(20)) d from table1
    union all
    select a,'',c,d from table2