• Post Reply Bookmark Topic Watch Topic
  • New Topic

performing addition to a integer value using sql

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have an Int column in a table and I need to be able to add a number to the current value in the table. i.e. current value + value = new value

eg. 5 + 10 = 15

How do i this using sql.I have tried the following but it does not work

UPDATE Locations SET hitCount = hitCount + 1 WHERE locationId = 2;

Thank you
david
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you get any error message ?

Shailesh
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!