title: entry cannot be referenced in this part of the query (subquery) Error
body: <p>I'm getting the following error on my query:</p>
  
  <pre><code>here is an entry for table "table1", but it cannot be referenced from this part of the query.
  </code></pre>
  
  <p>This is my query:</p>
  
  <pre><code>SELECT id 
  FROM property_import_image_results table1
    LEFT JOIN (
      SELECT created_at 
      FROM property_import_image_results
      WHERE external_url = table1.external_url
      ORDER BY created_at DESC NULLS LAST 
      LIMIT 1
    ) as table2 ON (pimr.created_at = table2.created_at)
  WHERE table2.created_at is NULL
  </code></pre>