title: Creating a query which checks for existence in one table from another based on multiple fields
body: <p>I've created a table (tblUploadCompletions) which is used to paste a temporary dataset into. I then want to run a query against this table to see if certain fields already exist in another table. If they do, the query will not include them. If they don't, then the query will be used as the basis of some INSERT INTO code that I'll write later.</p>
  
  <p>The code I'm currently running which works for identifying the existence of one field ("Ref") is:</p>
  
  <pre><code>SELECT tblUploadCompletions.case_id, tblUploadCompletions.ref, dim_brand.brand_prod_id, tblUploadCompletions.date_on_correspondance, tblUploadCompletions.action_completed_date, Dim_users.User_ID, tblUploadCompletions.action_type
  FROM (tblUploadCompletions INNER JOIN Dim_users ON tblUploadCompletions.completed_by = Dim_users.user_name) INNER JOIN dim_brand ON (tblUploadCompletions.brand_01 = dim_brand.brand) AND (tblUploadCompletions.product_02 = dim_brand.product_02) AND (tblUploadCompletions.workstream = dim_brand.Workstream)
  WHERE (((Exists 
          (SELECT 1 
                FROM all_actions
                        WHERE all_actions.ref = tblUploadCompletions.ref))=False) AND ((tblUploadCompletions.action_type)='File Request'));
  </code></pre>
  
  <p>I've tried a couple of methods to amend the "WHERE (((Exists" portion of the code to include an additional field but not had much luck. The additional field I'd need to match against is in another table so would need to include something like this in the sub query:</p>
  
  <pre><code>   WHERE (((Exists 
          (SELECT 1 
                FROM all_actions INNER JOIN Dim_brands on all_actions.brand_prod_id = dim_brands.brand_prod_id
  WHERE all_actions.ref = tblUploadCompletions.ref and dim_brands.stage = 'File Request'))=False) AND ((tblUploadCompletions.action_type)='File Request'));
  </code></pre>
  
  <p>Thanks in advance</p>