I am working with the following query:
SELECT A.ACTIVITY_NAME ,PS.CUSTOMER_FLAG ,C.CUSTOMER_EMAIL FROM TABLE_CUSTOMER_ACTIVITY A INNER JOIN TABLE_CUSTOMER_PROFILE PS ON A.CONTACT_ID = PS.CONTACT_ID INNER JOIN TABLE_CUSTOMER C ON A.CONTACT_ID = C.CONTACT_ID WHERE PS.CUSTOMER_GROUP='1' AND NOT EXISTS (SELECT * FROM TABLE_CUSTOMER_ARCHIVE B WHERE PS.CONTACT_ID = B.CONTACT_ID )
Can anyone explain what is happening in this part of the query?
AND NOT EXISTS (SELECT * FROM TABLE_CUSTOMER_ARCHIVE B WHERE PS.CONTACT_ID = B.CONTACT_ID )
I understand that it is doing an exclusion meaning, selecting all contacts based on the criteria and who do not exist in the TABLE_CUSTOMER_ARCHIVE but PS.CONTACT_ID = B.CONTACT_ID means inner join of TABLE_CUSTOMER_ARCHIVE and TABLE_CUSTOMER_PROFILE? meaning contacts who exists in TABLE_CUSTOMER_ARCHIVE as well as TABLE_CUSTOMER_PROFILE?