Mysql - update via db with "set price = price - 5%"

Asked

Viewed 126 times

-1

How do I update where it will decrease the price of the product by percentage?

Example:

Table:

id | products

10 | 1.40

How do I update to 1.40 - 5%?

1 answer

2

Five percent = 5 / 100

therefore:

preco = preco - ( preco * 5 / 100 )

Browser other questions tagged

You are not signed in. Login or sign up in order to post.