select * from table1 union select * from table2

解决方案 »

  1.   

    union all不会过滤两个表中相同的纪录
      

  2.   

    使用union时一定要注意两个查询语句的结果集的字段类型要一致,否则是没法进行union的
      

  3.   

    select a.*,b.* from table1 a,table2 b
      

  4.   

    --如果两个表字段类型一样直接用union all
    --如果没有任何关联
    select * from (select rownum as id,a.* from a) a,
                  (select rownum as id b.* from b) b
    where a.id=b.id(+);
      

  5.   

    select * from table1 union select * from table2
      

  6.   

    两个table的数据类型不一样
      

  7.   

    不一样
     select * from table1 union all select * from table2
      

  8.   

    t1 a,b
    t2 c,dselect a,b,'' c,'' d from table1 union all select '' a,'' b,c,d from table2
      

  9.   

    用union是类型必须要一样而长度不一定相同吗
      

  10.   

    用union,union的上面和下面的字段数必须一样多,类型必须一样.如果查看所有数据,要用union all .一样的要求字段数一样多,类型一样.
      

  11.   

    用union连接2个table取出的数据与用2个sql语句取出的数据哪个快一点呢,还是差不多呢,因为我现在想提高程序的执行速度
      

  12.   

    union 本来就是两个以上的sql执行后的联合.
      

  13.   

    我知道是sql的联合,问题是执行一条的速度(union)会比分着的快吗