我想调整以下查询以消除其中指定的 NOT EXIST 子句。你能帮忙吗?
GLT_temp_upload 是临时表,其中 DA_DUEDATE 是分区表,其中包含大量数据。
请帮忙
SELECT DISTINCT
batchid,
store_area,
STORE_AREA
|| ','
|| STORE_ID
|| ','
|| SMS_ID
|| ','
|| SMS_SERVICE
|| ','
|| SYNERGY_MODE_ID
|| ','
|| FREQUENCY
|| ','
|| DUEDATE
|| ','
|| STUDY_ID
|| ','
|| YEAR
|| ''
|| WEEK_ID
||',Not exist in Da_Duedate'
FROM GLT_temp_upload upload
WHERE upload.batchid = 1
AND NOT EXISTS
(SELECT due.week_id,
due.country_id,
due.year,
due.study_id,
due.store_id,
due.store_area,
due.synergy_mode_id,
upload.batchid,
due.due_date,
upload.sms_service
FROM DA_DUEDATE due
WHERE due.store_id = upload.store_id
AND due.study_id = upload.study_id
AND due.store_area = upload.store_area
AND due.frequency = upload.frequency
AND due.sms_service = upload.sms_service
AND due.week_id = upload.week_id
AND due.country_id = upload.country_id
AND due.year = upload.year
AND due.sms_id = upload.sms_id
AND due.synergy_mode_id =
upload.synergy_mode_id)