title: How can I SELECT the first row with MAX(Column value)?
body: <p>I want to select only one row from a table. This row  holds the maximum number in the table. I have tried to use MAX Fun but it didn't work for me. I use two tables to run my query, the first query returns more than one row</p>
  
  <pre><code> SELECT Rec_No FROM Records WHERE STATUS = 'Record Replaced'; 
  
   select Item_No, Quantity from Rec_details
   group by Item_No, Quantity
   having Quantity=max(Quantity);
  </code></pre>
  
  <p>I have the problem in the second query as I always get these records</p>
  
  <pre><code> Item_No     Quantity
   ---------- ----------
    12507          1 
    12549          4 
    12100          8 
    12501          2 
    12201          7 
    12509          3 
    12080          1 
  </code></pre>
  
  <p>My answer should check if the records replaced from the Records table and then    select the maximum quantity and Item_no from Rec_Details. In my case it should be: </p>
  
  <pre><code> Item_No     Quantity
  ---------- ----------
     12201          7 
  </code></pre>