Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incrementing a INT field

Status
Not open for further replies.

Shrum

Programmer
May 17, 2002
122
US
I'm wondering how to go about this:

I've a table in which I have a 'views' field. I would like to know whether there is a way to pass a command/func in SQL to MySQL that tells it to increment a specific field, say, where it's ID field = some value...ala:

Increment `views` + 1 WHERE 'id' = 123

Is this possible or do I have to code for this.

TIA

 
Oh yes, there is a very specific statement for this

Code:
update t set views = views + 1 where id = 4711
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top