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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:52:40+00:00 2026-05-13T09:52:40+00:00

I have three tables and I want to update all values for a particular

  • 0

I have three tables and I want to update all values for a particular type to the same value:

table1:
id, ValueType

table2:
id, Value

table3:
id, fkValueTypeId, fkValueId

fkValueType references ID in table1. fkValue references ID in Table2

I am trying to set all Speed values to the same value:

i.e.

Table1:
0, speed
1, age
2, colour

Table2:
0, 10
1, 20
2, 30
3, 40
4, 18
5, 18
6, blue
7, black
8, orange
9, 33
10, 34
11, 35

Table3:
0, 0, 0      --Speed = 10
1, 0, 0      --Speed = 20
2, 0, 0      --Speed = 30
3, 0, 0      --Speed = 40
4, 1, 1      --Age = 18
5, 1, 1      --Age = 18
6, 2, 2      --Colour = Blue
7, 2, 2      --Colour = Black
8, 2, 2      --Colour = Orange
9, 0, 9      --Speed = 33
10, 0, 10    --Speed = 34
11, 0, 11    --Speed = 35

What I want to do is Update Speed to ’55’ for all Speed entries in the tables so that table2 looks like this:

Table2:
0, 55
1, 55
2, 55
3, 55
4, 18
5, 18
6, blue
7, black
8, orange
9, 55
10, 55
11, 55

Hope this makes sense. I am not sure on the syntax and can do it using a loop but wondered if there is a better way (which I am sure there is!).

Thank you

  • 1 1 Answer
  • 1 View
  • 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-13T09:52:40+00:00Added an answer on May 13, 2026 at 9:52 am

    A rewrite of @hobodave’s answer:

    UPDATE table2
    SET Value = 55
    FROM table2
    JOIN table3 ON table3.fkValueId = table2.id
    WHERE table3.fkValueTypeId = 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three tables table1, table2 and table2. table1.parent_id is the id of a
Hi I have three tables and I want to know how much jobs with
I have three tables (individuals, groups & recordlabels) and want use the information between
I have three tables: articles(id int) tags(id int, name varchar(255)) articles_tags(article_id, tag_id) I want
So, I have three tables. Movies , movies_genres and genres . I want to
I have a database with three tables: user_table country_table city_table I want to write
I have two tables with a parent/child relationship. I want to update the parent
I have three tables. I have to retrieve the data using Linq statement. My
I have three tables of data: table: cars [10,000 rows] table: planes [2,000 rows]
I have three tables: Employee(EmployeeID,Fname,Lname...) ProjectHeader(ProjectID,LeadID,Status....) ProjectDetails(ProjectDetailsID,ProjectID....) Here's my current code: $get_projects = SELECT

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.