title: How to use ROWNUM for a maximum and another minimum ordering in ORACLE?
body: <p>Currently i am trying to output the top row for 2 condition. One is max and one is min.
  Current code </p>
  
  <pre><code>Select * 
  from  (MY SELECT STATEMENT order by A desc) 
  where ROWNUM &lt;= 1
  </code></pre>
  
  <p><strong>UPDATE</strong>
  I am now able to do for both condition. But i need the A to be the highest, if same then check for the B lowest.</p>
  
  <p>E.g Lets say there is 2 rows, Both A is 100 and B is 50 for one and 60 for other.
  In this case the 100:50 shld be choose because A is same then B is lowest.</p>
  
  <p>E.g
  Lets say there is 2 rows, A is 100 for one and 90 for other, since one is higher no need to check for B. </p>
  
  <p>I tried using max and min but this method seems to work better, any suggestions</p>