Not sure how to approach this one and would really value some help. Essentually I have 12,000 products in a database table (tbl_product)each with a unique stock code. Then in table two I have the same again only with each of the stock codes repeated with multiple buy prices, I need to select the cheapest buy price from multiple and then insert into the tbl_product.
So thats: select cheapest price from EACH stock code. (tbl_buy), for example there could be 12 distributors for each product. 1 of those distributors offers the cheapest price, of which I want to update the coresponding stock code in the other tbl_product table.
Think that makes sense.... any help would be greatly received.