Tuesday, 21 August 2012

How to increment SQL value

Here how it works. If we have table, for example table 'store' with 'id' and 'price' columns and we need to increment price to 5% for example.

UPDATE store SET price = price + ROUND(5*price/100, 0) WHERE id LIKE '%pattern%'