group by 汇总?聚合函数?sum()/count()?不明白楼主的意思。

解决方案 »

  1.   

    select sell_id as bill_id , client_id , job_date , account , sell_type as bill_type
    , memo from 表A
    union
    select fare_id as bill_id , client_id , job_date , account , fare_type  as bill_type
    , memo from 表B
      

  2.   

    select * from a
    union  all select * from (select fare_id as sell_id,client_id,  job_date , account  bill_type as sell_type  ,memo from b)c
      

  3.   

    是这个?select sell_id as bill_id
           ,client_id
           ,job_date
           ,account
           ,sell_type as bill_type
           ,memo
    from A
    union
    select ,fare_id
           ,client_id
           ,job_date
           ,account
           ,fare_type
           ,memo
    from B
      

  4.   

    抱歉,刚才我没说清楚,如:
    表A sell_id  client_id  job_date  account  sell_type  memo
      s0001   00001   05-9-1  100   销售
      s0002   00001   05-9-1  200   销售
      s0003   00002   05-9-1  100   销退表B fare_id  client_id  job_date  account  fare_type  memo
      f0001   00001   05-9-2  -50   付    退差价汇总合并后
    bill_id  client_id  job_date  account  bill_type  memo
    s0001   00001   05-9-1  100   销售
    s0002   00001   05-9-1  200   销售
    s0003   00002   05-9-1  100   销退
    f0001   00001   05-9-2  -50   付    退差价
      

  5.   

    将 union 换成 union all 不就可以了吗!!