title: Where clause to check against two columns in another table
body: <p>I am struggling to get this answer for some reason.</p>
  
  <p>I have two tables, table1 and table2 which look like this:</p>
  
  <p>Table1:</p>
  
  <pre><code>ID   Location  Warehouse
  1    London    Narnia
  2    Cyprus    Metro
  3    Norway    Neck
  4    Paris     Triumph
  </code></pre>
  
  <p>Table2:</p>
  
  <pre><code>ID   Area      Code
  1    London    Narnia
  2    Cyprus    Metro
  3    Norway    Triumph
  4    Paris     Neck
  </code></pre>
  
  <p>I need to first select everything from table1 where <code>table1.Location</code> is in <code>table2.Area</code> <strong>AND</strong> <code>table1.Warehouse</code> is in <code>table2.Code</code> <strong>GIVEN THAT</strong> <code>table1.Location</code> is in <code>table2.Area</code>. I.e. I want:</p>
  
  <pre><code>ID   Location  Warehouse
  1    London    Narnia
  2    Cyprus    Metro
  </code></pre>
  
  <p>I have got to:</p>
  
  <pre><code>select
    1.location
  , 1.warehouse
  from table1 1
  where 1.location in (select area from table2)
  and 1.warehouse in (select code from table2)
  </code></pre>
  
  <p>But this won't work because I need the second where clause to be executed based on the first where clause holding true.</p>
  
  <p>I have also tried similar queries with joins to no avail.</p>
  
  <p>Is there a simple way to do this?</p>