PDA

View Full Version : +1 to a row


fl00d
11-22-2008, 04:43 AM
Hi,

Is there a built-in function to add 1 to a row without having to query the db, return a value, add 1 to it, and update the row?

I've been looking all over but I haven't been able to efficiently phrase my question so I get optimal results on a search engine :/

Thanks for any input

PappaJohn
11-22-2008, 05:05 AM
UPDATE table_name SET field_name = fieldname + 1 WHERE where_clause here

fl00d
11-22-2008, 05:21 AM
Thanks :) I didn't realize it was as simple as that.

PappaJohn
11-22-2008, 05:34 AM
You're welcome.

Expressions can be used in SQL queries. In SET clauses (like above) and in the WHERE, ORDER BY and HAVING clauses.