SQL文を作成しましたが、個々の文はうまく機能しますが、UNIONを使用して結合すると、私が行方不明になっているエラーやこれを高速化する方法はありますか?UNIONを使用すると、SQL文の実行時間が大幅に遅くなります
select bundle.bundle, bundle.week, bundle.sched_dt, dropper_assign.dropper_id
from bundle, dropper_assign
where bundle.bundle not in
(select bundle from forecast_entry)
and bundle.week = dropper_assign.week
and bundle.sched_zip3 = dropper_assign.zip3
and bundle.sched_dt = dropper_assign.sched_date
and bundle.project_cd = dropper_assign.project_code
and dropper_assign.dropper_id <> 10002
and bundle.project_cd = 'EXFC'
union
select bundle.bundle, bundle.week, bundle.sched_dt, splits.dropper_id
from bundle, splits
where bundle.bundle not in
(select bundle from forecast_entry)
and bundle.bundle = splits.bundle
and splits.dropper_id <> 10002
and bundle.project_cd = 'EXFC';
重複がない場合は、代わりに 'UNION ALL'を使用してください – van