title: Oracle sql missing right parenthesis
body: <p>I'm trying to limit the number of rows that would be displayed when I run my query.
  When I run the code below in SQL developer, it returns missing right parenthesis error..</p>
  
  <pre><code>select * from
  (select row_number()  over (order by rescode) rnum, a.* from
      (    
       SELECT * 
       FROM trans z 
       LEFT JOIN emails a 
       ON z.email1_hist_id=a.email_id 
       or z.email2_hist_id=a.email_id 
      ) a
  )   where rnum between 1 and 50;
  </code></pre>
  
  <p>I tried running the inside query:</p>
  
  <pre><code>SELECT * 
  FROM trans z 
  LEFT JOIN emails a 
  ON z.email1_hist_id=a.email_id 
  or z.email2_hist_id=a.email_id
  </code></pre>
  
  <p>and it works fine. On the other hand I tried removing the OR portion of my query and included the limit rows query and it returns the number of rows I specified.</p>
  
  <p>What exactly is wrong in my code? </p>