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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:30:14+00:00 2026-05-23T01:30:14+00:00

Here is a simplified table structre for what I am trying to do: T1:

  • 0

Here is a simplified table structre for what I am trying to do:

T1:
id,uid,group,value1
1,1,A,3
2,1,B,4
3,2,A,6
4,2,B,7

now I want that any uid that has both a row for group A and group B the value assosicated with group B will be added to the value in the row associated with Group B.

so the result for the above would be
1,1,A,7 (3+4)
2,1,B,4
3,2,A,13 (6+7)
4,2,B,7

there might also be uids for which only group A exists or only groups B exists in which case no changes t those lines should take place.

What I did so far is that I created a query that has one row for any row that needs to be updated:

id,uid,newval
1,1,7
3,2,13

The subquery is somewhat complex and joins the table that needs to be updated with it self.

now how do I use this to update the original table? (or how do I do it some other way)?

thanks.

  • 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-23T01:30:15+00:00Added an answer on May 23, 2026 at 1:30 am
    Update T1
    set Value1 = T1.Value + T2.Value
    from T1 inner join T1 as T2 on T1.uid = T2.uid
    where T1.group = "A" and T2.group = "B"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a simplified transactions table. Each row is a transaction that has a
Here's a simplified version of what I'm trying to do : Before any other
Here is a simplified version of my table: group price spec a 1 .
I have an html table. Here is a simplified version: <table> <tr> <td><div style=display:
I've got 3 tables that are something like this (simplified here ofc): users user_id
I want to list all users with their corropsonding user class. Here are simplified
Here is a simplified table structure: TABLE products ( product_id INT (primary key, auto_increment),
I am trying to display every odd instance of a table row, however there
Here's my simplified table (SQL Server 2005): table1: col1 int, col2 int, col3 cast(col1/col2
I've hit a bit of a wall ... here is my simplified schema: TABLE

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.