ここに と という名前の 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')
ありがとう!