Need to add a discount to a order table

  • I need to create a stored procedure to add a discount to an order. This stored procedure has five input parameters:

              OrderID, ProiductID, UnitPrice, Quantity, and DiscountValue.

    This stored procedure needs to display all the orders with a discount, including the ones added by the stored procedure.

     

    Any suggestions would be helpful.

     

  • You should be able to do this with a SELELCT statement using CASE. 

    For exampl CASE WHEN DiscountValue = 0 THEN (UnitPrice * Quantity) ELSE ((UnitPrice * DiscountValue) * Quantity) END as Price, OrderID, ProcuctID. 

    I wasn't born stupid - I had to study.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply