Correlated query to find cheapest manufacturer

vendredi 27 mars 2015

Hi,



I have a SQL Query that returns me:

- the "product code" i must purchase,

- the "quantity" to purchase for this product

- and if it's in "promotion or not".



Based on this result, i must to look at "manufacturer" table and find the cheapest "price" for each product to purchase and the quantity available at the manufacturer.

If "quantity to order" (e.g. 20) is higher than "quantity available" (e.g. 12) at "cheapest manufacturer", i must order the missing quantity (8) to the next cheapest manufacturer.

How can i do that ?



thx

Correlated query to find cheapest manufacturer

0 commentaires:

Enregistrer un commentaire

Labels