Calculate discount amount based on percentage in column

I have 2 fields in our database, price and discountpc, which are both numeric(15,2). I need to calculate the discount as an amount.

So, for example, if the price is 32.21 and the discountpc is 20.00, I need to return 6.44 as the actual discount value (20% of 32.21).

I have tried:

ptm.PRICE/nullif(ptm.discountpc,0) DISCAMT

but using the values above I get 1.61 instead of 6.44

I know there must be a really simple answer but I'm struggling today for some reason!


Could you use ptm.PRICE(ISNULL(ptm.discountpc,0)/100.0)*

1 Like

Yes, that's it thank you.