Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7420095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:10:48+00:00 2026-05-29T08:10:48+00:00

I need to update each row of a table with one column as sum

  • 0

I need to update each row of a table with one column as sum of other two columns in the same table

Something like this

UPDATE table1 SET table1.column1 = sum (table1.column1 +
table1.column2) for every row

I have tried

This is working for me

UPDATE table1 SET column1 =(SELECT  SUM(column1 + column2)  FROM table1 where rowid = 1) WHERE rowid = 1

So I can do this by iterating each rowid by first selecting all rowId

for( all rowid as i){
    UPDATE table1 SET column1 =(SELECT  SUM(column1 + column2)  FROM table1 where rowid = i) WHERE rowid = i
    }

But I need to do for all the rows in that table in one query

When I tried:

update table1  set column1  = (select (column1  + column2) from table1 )

this will summ all the values of column1 and column2
i want to do wrt to a row

Any idea?

Me working in sqLite for Android

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:10:48+00:00Added an answer on May 29, 2026 at 8:10 am

    There’s no need for loops or inner selects. Just try this:

    UPDATE table1 SET column1 = column1 + column2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, each one has a primary ID column as key. I
I want to update rows of a table in a specific order, like one
I have two tables. Table #1 'color' has columns [red], [blue], [green]; where each
I need to update two tables inside a single transaction. The individual queries look
I need to update a table, and the Where clause should contain the last
Using the ASP.NET grid view. It displays 3 columns with 1 row for each,
[Previous essay-title for question] Oracle SQL: update parent table column if all child table
I have two Oracle refcursors one containing list of Rows(CustomersList) and the other containing
I need to keep track of the number of times each row in a
I have a databases table with ~50K rows in it, each row represents a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.