title: What's the best way to compare one table's data against another?
body: <p>I have 2 select statements:</p>
  
  <pre><code>SELECT DISTINCT Email
  FROM         dbo.Customers
  WHERE     (Email IS NOT NULL) 
  AND (Email LIKE '%@%') 
  AND (RIGHT(Email, 4) IN ('.net', '.com', '.org')) 
  AND (Email NOT LIKE '%@UniformCity.com') 
  AND (Email NOT LIKE '%@LifeUniform.com') 
  AND (CHARINDEX('.',Email) &lt;&gt; 1)
  AND (RIGHT(RTRIM(Email), 1) &lt;&gt; '.') AND (LEFT(LTRIM(Email), 1) &lt;&gt; '@') 
  AND (Email not Like '%[`:;_*-,^[^]()+%\/=#-]%' escape '^') order by Email
  </code></pre>
  
  <p>AND </p>
  
  <pre><code>SELECT  replace(replace(
  replace(
  replace(EmailOptOut,'"','')
  , ',held','')
  , ',unsub','')
  , ',confirm','') 
  as CleanEmail
  FROM [LifeMail].[dbo].[EmailOptOuts]
  </code></pre>
  
  <p>I only want to select the emails from the <code>Customers</code> table, THAT ARE NOT in the <code>EmailOptOuts</code> table.  What's the best way to achieve this?  I thought about using cursors and looping...  </p>