Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select minimum results

Status
Not open for further replies.

heals1ic

Programmer
Apr 25, 2006
15
AU
I have a table structured as such:

customerid, productid, price

I would like to extract the minimum price for each product and which supplier it is.

this is my code so far:

SELECT supplierid, productid, min(price) FROM `sup_prices` group by price order by productid

This gives me all the records.

Any idea how to modify this code to do what I need?
 
Just analysing the query.

How will it react if 2 suppliers have the same minimum price?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top