title: SQL to return the rownum of a specific row? (using Oracle db)
body: <p>In Oracle 10g, I have this SQL:</p>
  
  <pre><code>select dog.id as dogId from CANINES dog order by dog.codename asc
  </code></pre>
  
  <p>which returns:</p>
  
  <pre><code>id
  --
  204
  203
  206
  923
  </code></pre>
  
  <p>I want to extend this query to determine the oracle rownum of a dog.id in this resultset.</p>
  
  <p>I have tried</p>
  
  <pre><code>select rownum from 
  (select dog.id as dogId from CANINES dog order by dog.codename asc) 
  where dog.id=206
  </code></pre>
  
  <p>But this does not work out very well (it returns 1 no matter which dog.id I match on).  I was expecting to get back 3.</p>
  
  <p>Thanks for your help!</p>
  
  <hr>
  
  <p><em>Notes</em></p>
  
  <p><a href="http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html" rel="nofollow noreferrer">http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html</a></p>
  
  <p>I am pretty sure I do not need to use rowid</p>