这道题没说是内连还是外连,应该也不是笛卡尔乘积吧。应该怎么做?

解决方案 »

  1.   


    -- 这不可以吗
    select * 
    from a
    union all
    select * 
    from b
      

  2.   

    使用连接就行了吧
    select * 
    from fc_accbook_dtl
    union all
    select * 
    from fc_accbook_dtl_his
      

  3.   

    精确点说,还需要明确当前明细表中是否会有数据存在历史明细中,也就是说是否有可能存在重复数据。
    select*from fc_accbook_dtl where not exists(select 1 from fc_accbook_dtl_his where order_no=a.order_no)
    union all
    select*from fc_accbook_dtl_his
      

  4.   

    --使用union 连接
    select * 
    from a
    union all
    select * 
    from b
      

  5.   

    select * from fc_accbook_dtl_his 
    --历史帐里的就是所有数据吧