I have two tables that have 5 columns in common, but there are rows missing from one that are present in the other. Can I use "WHERE NOT EXISTS", or something similair, that can select these rows from table A that are missing from table b so that I can insert them? As some background, one table is based off of forecasted data and the other is based off of actuals and the delta is that there are some intervals where, despite there being a forecast, there are no actuals.
Code:
SELECT
DAT_WWCP_STF_DATA.SITE
,DAT_WWCP_STF_DATA.FCST_GROUP
,DAT_WWCP_STF_DATA.INTERVAL AS ARRIVAL_INTERVAL
,DAT_WWCP_STF_DATA.DATE AS ARRIVAL_DATE
,DAT_WWCP_STF_DATA.FORECAST
FROM DAT_WWCP_STF_DATA
WHERE NOT EXISTS
(
SELECT
EMAILS_RESOLVED_SUMMARY.SITE
,EMAILS_RESOLVED_SUMMARY.FCST_GROUP
,EMAILS_RESOLVED_SUMMARY.ARRIVAL_INTERVAL
,EMAILS_RESOLVED_SUMMARY.ARRIVAL_DATE
,EMAILS_RESOLVED_SUMMARY.FORECAST
FROM EMAILS_RESOLVED_SUMMARY
);