Rawhi
Rawhi

Reputation: 6413

How can I increment a database value in SQL?

I'm facing a problem with a voting system specially in the vote up feature.

How can I make something like votes++ in the database without the need to select the last votes in single query?

Upvotes: 0

Views: 67

Answers (1)

Glenn
Glenn

Reputation: 9170

UPDATE myTable
  SET voteCol = voteCol + 1
  WHERE id = idOfInterest;

Upvotes: 2

Related Questions