ここに と という名前の 2 つのテーブルがmain_tableありmain_table_replicaます。main_table_replicaのレプリカですmain_table。main_tableしかし、問題は、またはのいずれかでデータを見つけることができることmain_table_replicaです。今、私は以下のようにクエリを実行しています。ここで組合を避けるにはどうすればよいですか?両方のクエリで唯一の変更はmain_tableとmain_table_replicaです。
SELECT DISTINCT e.some_id
FROM
main_table e, //Change is here
main_table_join_one x
where e.some_id = x.some_id(+)
and (x.status in('A','I') or x.status is null)
and e.code='XYZ' and e.second_code in('XYZ','ABC')
UNION
SELECT DISTINCT t.some_id
FROM
main_table_replica t, //Change is here
main_table_join_one xf
where t.some_id = xf.some_id(+)
and (xf.status in('A','I') or xf.status is null)
and t.code='XYZ' and t.second_code in('XYZ','ABC')
ありがとう!