telsiin Posted May 14, 2007 Share Posted May 14, 2007 Good afternoon to all the Pros I have a table that has numeric data type float on which I perform a simple update on base on a store ID What I would like to do is instead of doing an Update, is add or subtract a value to the existing value in the table. Example Select * from fruitvendor where storeID='123' and stock='y'; Record shows something like this Apple NY y 20 Pear NJ y 20 Orange FL y 20 Cherry NJ y 20 Strawberry FL y 20 Peach GA y 20 Watermelon CA y 20 Grape CA y 20 Pineapple FL y 20 Blueberry FL y 20 I would like to Add 3 to apple, cherry, watermelon giving me 23. Add 4 to pear, strawberry, pineapple giving me 24. Subtract 5 from orange, grape, and blueberry giving me 15 Your help and suggestion will greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/51393-modifing-record-without-update-basic-math/ Share on other sites More sharing options...
Barand Posted May 14, 2007 Share Posted May 14, 2007 You are still going to need an update query, such as UPDATE fruitvendor SET value = value+3 WHERE fruit IN ('apple', 'cherry', 'watermelon') Quote Link to comment https://forums.phpfreaks.com/topic/51393-modifing-record-without-update-basic-math/#findComment-253087 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.