还有
把两个表的查询结果生成一个表又怎么做?问题可能有些弱智,但是比较急,请各路英雄出手搭救啊!

解决方案 »

  1.   

    把两个表的查询结果生成一个表又怎么做?
    select ... into newtable
    from old1,old2
    where ...
      

  2.   

    二表关联,然后合并相同字段的那一列,如何做?是不是要
    select ...,old1.col1+old2.col1 as col1
    from old1,old2
    where ...
      

  3.   

    select A.a,A.b,A.other,B.other from A,B
    where A.a =B.a and A.b=B.b
    楼主的意思是,字段关联的,且相等的,只取其中一个表的,不知我理解可对。
    要生成一个新表:
    select A.a,A.b,A.other,B.other into #t from A,B
    where A.a =B.a and A.b=B.b
      

  4.   

    创意、自由、灵活,超强的报表功能,
    独特的双数据源连接,全功能的表格组件!http://www.anylib.com
      

  5.   

    select col1 from table1
    UNION ALL
    select col1 from table2
      

  6.   

    等值连接不就行了,select 出要出现的表中的字段。select * from table1
    union select * from table2
    into newtable
    (两个table字段兼容)
      

  7.   

    t1
     a  b 1  123
     2  132t2 
     a  c
     1  323
     2  333select t1.a,t1.b,t2.c from t1,t2 where t1.a=t2.a  显示2个表 a关联只显示一次
      

  8.   

    1>"二表关联,然后合并相同字段的那一列":这个用连接
    比如:表1(id)和表2(tid)相同.
    select a.*,b.* from 表1 a join on 表2 b on 表1.id=表2.tid [where.....]2>两个表的查询结果生成一个表:可以用UNION(不过,前提是这N个表的结构类型都相同)
    比如:表1和表2的结构相同.
    select * from 表1 
    union
    select * from 表2
    .....
      

  9.   

    支持楼上sun30(勇敢飞翔) ( ) 信誉:100 
    1>"二表关联,然后合并相同字段的那一列":这个用连接
    比如:表1(id)和表2(tid)相同.
    select a.*,b.* from 表1 a join on 表2 b on 表1.id=表2.tid [where.....]2>两个表的查询结果生成一个表:可以用UNION(不过,前提是这N个表的结构类型都相同)
    比如:表1和表2的结构相同.
    select * from 表1 
    union
    select * from 表2
    .....
      

  10.   


    select 
          A.id,
          A.名字 + B.名字 as 新名字
    from A 
          inner join B on A.id=B.id