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 6729249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:16:01+00:00 2026-05-26T10:16:01+00:00

I have a table like this a_count b_count total_count(a_count+b_count) 2 3 5 1 4

  • 0

I have a table like this


    a_count        b_count          total_count(a_count+b_count)
    2                 3              
    5                 1
    4                 7
    5                 0



This is my table I need to update total count field using a single query. How can I write that kind of a query?
I need output like this


    a_count        b_count          total_count(a_count+b_count)
    2                 3                   5
    5                 1                   6
    4                 7                   11
    5                 0                   5

  • 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-26T10:16:01+00:00Added an answer on May 26, 2026 at 10:16 am

    To update the values of those fields in the table:

    UPDATE mytable SET total_count = a_count + b_count
    

    To get those fields from the table:

    SELECT a_count, b_count, total_count FROM mytable
    

    To get those fields without that total_count column:

    SELECT a_count, b_count, (a_count+b_count) AS total_count FROM mytable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that looks like this: id count 1 100 2 50
I have a table like this (using wordpress) +---------+----------+------------+ | meta_id | meta_key |
I need to get the nid alone in this query. SELECT count(nid) as total,nid
I have mysql table with data like this. record will have server with total
I have a table like this Table A: Id Count 1 4 1 16
I have data that looks like this: Table Group: A , Color: Blue, Count:
I have a table like this: How do I count rows that have identical
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ
If I have a table like this: CREATE TABLE sizes ( name ENUM('small', 'medium',
I have a table like this: <table> <tfoot> <tr><td>footer</td></tr> </tfoot> <tbody> <tr><td>Body 1</td></tr> <tr><td>Body

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.