title: An sql query to get small qty value from a list of products
body: <p>I have a product table. look like this.</p>
  
  <p>I want my output to be like the following.
  means only single product  row where the qty would be the small</p>
  
  <p><pre><br>
         id     Product     Qty    Rate 
          1     AAAA       200     100 
          1     AAAA       400     200 
          1     AAAA       800     400 
          2     BBBB       500     150 
          2     BBBB      1000     300 
  </pre>
  I need the output like this. Means only the small qty of a product to display        </p>
  
  <pre>
          id     Product     Qty    Rate 
          1     AAAA       200     100 
          2     BBBB       500     150 
  </pre>      
  
  <p>I wrote this query but can it be a single query with one while loop.</p>
  
  <pre>$query="SELECT  id FROM hproducts where category='".$category."'group by  id order by qty";
      $result=mysql_query($query);
      while($notic = mysql_fetch_array($result))
      {       
      $query2="SELECT  id,productname,rate,qty,image FROM hproducts where id='".$noti['id']."'group by  id,productname,rate,qty,image order by qty limit 1";
      $result2=mysql_query($query2);
      while($noticia = mysql_fetch_array($result2))
      {
       ...
      }
      }
  </pre>