SELECT ORDERS.orderid, INVENTORY.partid, Inventory.description, ORDERITEMS.qty, Inventory.price, (OrderItems.qty * Inventory.price) as 'Total Original Price', --If an order contains five or more units of a given product, give a 2% discount for that line item. (OrderItems.qty * Inventory.price * CASE WHEN OrderItems.qty >= 5 THEN 0.05 ELSE 0.1 END) as 'Total Discounted Value', --If an order contains ten or more units of a given product, give a 5% discount on that line item. (OrderItems.qty * Inventory.price * CASE WHEN qty >=10 THEN 0.95/0.9 END) as 'Total Final Price of Each Product After Discount' FROM orders, inventory, orderitems WHERE ORDERS.ORDERID = ORDERITEMS.ORDERID AND ORDERITEMS.PARTID = INVENTORY.PARTID AND ORDERITEMS.qty >=5 AND ORDERITEMS.qty >=10 ORDER BY ORDERS.orderid, INVENTORY.partid
AND ORDERITEMS.qty >=5 AND ORDERITEMS.qty >=10
CASE WHEN OrderItems.qty >= 5
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)