I have table 'products' and I need to update 'price' field by 20% if product 'type' field is "imported".
How do I read and update field at the same time in my UPDATE query?
views:
32answers:
2
+6
A:
You can do that using the SQL's Update statement
:
UPDATE products
SET price = price * 1.2
WHERE type = 'Imported'
This will increase the price
of all imported
products
by 20%.
codaddict
2010-03-12 03:07:29
+4
A:
This should do the trick:
UPDATE products SET price = (price * 1.2) WHERE type = 'imported'
Mike Cialowicz
2010-03-12 03:07:54