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

The Archive Base Latest Questions

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

I have a feeling that this query is pretty easy to construct, I just

  • 0

I have a feeling that this query is pretty easy to construct, I just can’t figure it out.

I want to replace all numbers in table X column C, with numbers in table Z column A, where numbers from table X column C matches numbers in table Z column B.

I hope that makes sense. Perhaps a little background information will make it clearer. I’ve converted from one CMS to another, and the module I used to convert mapped the ids to the new database. Table X column A is the new id’s. Table X column B is the old id’s.
Table Z is the table for an image gallery that I migrated, and column C contains the id’s of the images owners.

Can anyone crack this nut?

  • 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-14T00:19:24+00:00Added an answer on May 14, 2026 at 12:19 am

    Just for the completeness the first answer syntax error is due to the FROM. Update syntax need no FROM, as the UPDATE defines all the tables and joins and the SET actually defines what is to be updated. It’s a bit backwards as far as straight semantics goes and not as nice as SELECT … FROM … which sounds like natural language. For example, you would say

    UPDATE X, Z
    SET    X.C = Z.A 
    WHERE  X.C = Z.B
    

    even though you will not be updating the table Z at all, but one gets used to it. Good part is that you would write the UPDATE part exactly like you would write the FROM part in the SELECT queries – so it can be as complex as you need it to be and still makes it easy to turn SELECT queries into UPDATE queries (previewing your UPDATE queries sets with SELECT is a good practice on any ad-hoc queries on live data).
    To go from UPDATE query to SELECT just replace UPDATE with FROM, SET with SELECT, equal signs with commas (in the SELECT part) and of course put the select on top

    SELECT X.C, Z.A
    FROM   X, Z
    WHERE  X.C = Z.B
    

    Will give you a preview of the operation that’ll get executed, listing the old value of the field and new value that’ll get assigned to it.

    Mysql has decent docs. You might prefer to read them backwards – first the examples toward the end, then the full reference definitions. Also usually you’ll find some really usefull comments below the articles.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strong feeling that all mathematical operations unnecessary to the query itself
I somehow have the feeling that modern systems, including runtime libraries, this exception handler
This is an SDL problem, however I have the strong feeling that the problem
I have a feeling I'm going about this all wrong. But anyway. I have
i have a query that return only one row (always) and i want to
I have a MySQL query that results in something like this: person | some_info
This is my first post and I have the feeling that this is something
I have a feeling that I am going to ask a stupid question, yet
Have a couple questions, using GSON. I have a feeling that GSON might not
I have an SQL query that executes a LEFT JOIN on another table, then

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.