Jump to content

SQLITE ADD 1 to Existing Value


Recommended Posts

I'm after a little help with an SQL query.

I've been trying to find out how you add 1 to every value of a single column in a SQLITE table, I'm sure there is an easier way than querying every row and adding 1 but I'm not having much luck finding out how.

I guess you can do something like this...

"UPDATE PRODUCTTABLE SET Product +=1;"

Is it possible to do this?

Ta

Link to comment
Share on other sites

I'm after a little help with an SQL query.

I've been trying to find out how you add 1 to every value of a single column in a SQLITE table, I'm sure there is an easier way than querying every row and adding 1 but I'm not having much luck finding out how.

I guess you can do something like this...

"UPDATE PRODUCTTABLE SET Product +=1;"

Is it possible to do this?

Ta

one query really is the fastest easiest way to do it; but make sure that you have a where statement unless you want every single row updated. i'm not sure if you can do the increment and assign like that though, may have to actually write out "product = product + 1"
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...