I want to show the results of both tables on the same querys, the tables are identical but one stores historic information and the other one has today's info (online), my tables look something like this.
Historic Table: TBL1
T_ID Resolve Date
---------- ------------ ------------
AD_1234 GOOD 12/18/16
VF_4569 BAD 12/19/16
RT_5436 GOOD 12/17/16
Online Table: TBL2
T_ID Resolve Date
---------- ------------ ------------
AR_2334 BAD 12/20/16
FT_1362 BAD 12/20/16
GH_5676 GOOD 12/20/16
Expected Result: TBL3
T_ID Resolve Date
---------- ------------ ------------
AD_1234 GOOD 12/18/16
VF_4569 BAD 12/19/16
RT_5436 GOOD 12/17/16
AR_2334 BAD 12/20/16
FT_1362 BAD 12/20/16
GH_5676 GOOD 12/20/16
Can't create new tables, views or any kind of objects it has to be done by query.
I Keep getting duplicate records and I know I dont have the same data on either table.
select o.transaction_id, o.ts_0002
from data_headers1 o
where
virtual_table_id = '5237260000000002621'
union all
select h.transaction_id, h.ts_0002
from data_headers1_hist h
where virtual_table_id = '5237260000000002621'
and TO_CHAR(h.ts_0002, 'YYYY/MM/DD HH24:MI:SS') >= '2016/12/01 00:00:00'
and TO_CHAR(h.ts_0002, 'YYYY/MM/DD HH24:MI:SS') <= '2016/12/30 23:59:59';