-- 这不可以吗 select * from a union all select * from b
使用连接就行了吧 select * from fc_accbook_dtl union all select * from fc_accbook_dtl_his
精确点说,还需要明确当前明细表中是否会有数据存在历史明细中,也就是说是否有可能存在重复数据。 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
--使用union 连接 select * from a union all select * from b
-- 这不可以吗
select *
from a
union all
select *
from b
select *
from fc_accbook_dtl
union all
select *
from fc_accbook_dtl_his
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
select *
from a
union all
select *
from b
--历史帐里的就是所有数据吧