title: SQL Correlation error using OVER & PARTITION in SELECT statement
body: <p>I am getting the following error when I am trying to execute my SQL SELECT statement</p>
  
  <pre>
  Could not execute statement.
  Correllation name 'contact' not found
  SQLCODE=-142, ODBC 3 State"42S02"
  Line 1, Column 1
  </pre>
  
  <p>My code is as follows</p>
  
  <pre><code>Select forename, surname, email, quotedate
  From ( SELECT  *, ROW_NUMBER() OVER (PARTITION BY tblQuote.contno ORDER BY quoteno DESC) AS rn
  FROM dba.quotehdr as tblQuote left join dba.contact as tblContact on tblQuote.contno = tblContact.contno)q
  where rn = 1 and quotedate &lt;=today()-720 and emailbounced = 0 and email is not null and dba.contact.statusflag = 'A'
  order by quotedate desc
  </code></pre>
  
  <p>This error only happended when I added in</p>
  
  <pre><code>dba.contact.statusflag = 'A'
  </code></pre>
  
  <p>I have tried this as </p>
  
  <pre><code>tblContact.statusflag = 'A'  
  </code></pre>
  
  <p>and I get the same error!</p>
  
  <p>Any suggestions?</p>