title: SQL MIN function selecting row
body: <p>So, I have a table and I wish to display the row with MIN price... </p>
  
  <pre><code>sellers - saleid, productsid[fk for products table], cid[fk for customers table], quantity
  price.
  </code></pre>
  
  <p>Here are a few records: </p>
  
  <pre><code>sellers =1,2,2,200,5.00
  sellers=2,3,4,100,1.00
  </code></pre>
  
  <p>I do this query: </p>
  
  <pre><code>select ProductID, Quantity, MIN(Price) FROM sellers
  </code></pre>
  
  <p>and I get this output</p>
  
  <pre><code>2,200,1.00
  </code></pre>
  
  <p>Why does it show the min Price however the first record column?
  It should display i.e. the corresponding row...</p>
  
  <pre><code>3,4,1.00
  </code></pre>
  
  <p>Any idea why this is?</p>
  
  <p>=========EDIT=======
  Thanks for the suggestion guys it works. I have now another small problem. I wish to select the MIN price for each product. Is there a query I can use to do this? So, if for example this is the new sellers table:</p>
  
  <pre><code>sellers =1,2,2,200,5.00
  sellers=2,3,4,100,1.00
  seller=3,2,3,250,3.00
  </code></pre>
  
  <p>then the min price for products 2,3 would be </p>
  
  <pre><code>sellers=2,3,4,100,1.00
  seller=3,2,3,250,3.00
  </code></pre>
  
  <p>How can I do something like this using the min function? I have tried</p>
  
  <pre><code>select c.Fname p.ProductName, s.ProductID, s.Quantity, s.Price 
  FROM sellers s, products p, customer c
  WHERE s.Price = (select MIN(Price) FROM sellers WHERE p.ID=s.ProductID AND c.ID=s.cid);
  </code></pre>
  
  <p>This however does not seem to output the min price per unique product. Any ideas as to how I can rectify this?</p>
  
  <p>Thanks</p>