title: MySQL syntax for treating an inline CSV as a temporary table?
body: <p>Temporary table may be overkill for what I'm trying to do. Basically, I want to invert the following MySQL query:</p>
  
  <pre><code>select email
  from email_newsletter_subscriptions
  where unsubscribeDate is not null
      and email in (
          # CSV list of email address
      )
  </code></pre>
  
  <p>This query gives me the list of email addresses that exist in the table and have unsubscribed. What I want are the list of emails in my in my CSV that <em>don't</em> exist in <code>email_newsletter_subscriptions</code> OR does exist but has a null <code>unsubscribeDate</code>.</p>
  
  <p>I found one crazy work around that's surprisingly snappy for my dataset (~1k rows), but gets unwieldy just to create for larger input sets.</p>
  
  <pre><code>select email from (select 'john.doe@exmple.com' as email union all
                     select 'jane.do@example.com' as email) e
  left join email_newsletter_subscriptions ens using(email)
  where ens.email is null OR ens.unsubscribeDate is null;
  </code></pre>
  
  <p>Is there an easier syntax that can just take the input as a CSV without having to turn every line into a <code>select ... union all</code> monstrosity?</p>
  
  <p>I'm also aware that we could load these into a temporary table and get a lot more options, but I'd really like to have a simple, single-query method for copy-paste drop in that works (I don't always have temporary table permissions on the target environment).</p>