0

I have two tables, a product table which contains:

Product
-----------
ProductName
Supplier,'reference supplier'
sku
Description
Price

then I have a supplier table

Supplier
---------
SupplierName
Discount

My question is, how can I calculate in sqlite the price based on the discount? The price will be dynamic and that is why I think its a better idea to do the calculation upon retrieval of the product. That way if the Discount changes, the price changes.

weemo
  • 7
  • 1
  • 4

1 Answers1

0

SELECT Price * (1 - Discount/100.0) as final_price from Product p join Supplier s on s.supplier_name = p.supplier where productname = ?

Should sort you.

hd1
  • 33,938
  • 5
  • 80
  • 91