beta.blog

MySQL: Increase field value by 1 (simple way)

by on May.17, 2011, under Programming

Increasing the value of a MySQL value is pretty simple. The most easy way I can think of is to increase the value directly in an update query. It is a very quick solution and works neatly:

UPDATE hits SET count=count+1 WHERE page='google.com';

Explanation: The query is going to add 1 to the field count in the table hits where page = google.com


Leave a Reply

*

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!