Forum Moderators: coopster

Message Too Old, No Replies

adding to a number in a sql db

         

Sarah Atkinson

2:06 pm on Jun 13, 2007 (gmt 0)

10+ Year Member



I have 6 tables in a database all with a field called price. I want to add 200 to each entry in the price field.

My first though was to do a Select statement and select all the "price"s then do a while statement that adds the 200 to each one then uses an UPDATE to make the change.

After thinking some more. Couldn't I do this in one query instead of two?
Isn't there a simpler way?

Duskrider

2:16 pm on Jun 13, 2007 (gmt 0)

10+ Year Member



Query:

"UPDATE mytable SET price = (price + 200)"

Should do it.