表A 有字段A,B,C
表B 也是字段A,B,C
把两张表连接起来后.根据字段c对查询结果进行排列

解决方案 »

  1.   

    select * from ta
    union all
    select * from tb
    order by c
      

  2.   

    select * from(
    select * from A union all
    select * from B)a
    where c='as'
    order by c
      

  3.   

    select * from a union select * from b order by c其实楼上的加不加T都代表“表”的名字。呵呵!
      

  4.   


    select * from A
    union all
    select * from B
    order by c
      

  5.   

    CREATE PROCEDURE P_GetMapSearch 
    @district VarChar(30)
    ASselect * from Message  where district=@district
    union all 
    select * from Message2 where district=@district
    order by datetime
    GO出现错误205 包含UNION 运算符的SQL语句中的所有查询都必须在目标列表中具有相同数目的表达式??
    这是什么原因
      

  6.   

    两表列数不同,字段个数不同。可以写成
    select a,b from ta
    union all
    select a,b from tb