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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:20:01+00:00 2026-06-11T19:20:01+00:00

This is a very simplified graphical situation of the matter: https://i.stack.imgur.com/5NoRe.png There are two

  • 0

This is a very simplified graphical situation of the matter: https://i.stack.imgur.com/5NoRe.png

There are two DBs in different schemas, the old yellow one (one simple and plain table) and the new green one (with some relations like the one described above).

The matter is that I want to migrate the info on the OldDB (over 40k rows) into the NewDB and I’m stucked with this relationship transformation. In the OldDB we had different fields for each center and depending on if their CHAR(1) = Y or = N, they were under some action or not.

Now in the NewDB we have those centers in another table with their own id, and related with a Many to Many to the main table (b).

So what I want is to go through each single center in the Old.DB (up to 20) and when it turns to be for example center14 CHAR(1) = Y, to set the NewDB.center_has_b.center_id = 14 and NewDB.center_has_b.b_id = OldDB.oldb.oldb_id.

I’m a newbie in MySQL but I was thinking on doing something like this, with no luck:

INSERT NewDB.center_has_b (center_id, b_id) (N, (SELECT oldb_id from OldDB.oldb WHERE centerN = 1));
  • 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-06-11T19:20:02+00:00Added an answer on June 11, 2026 at 7:20 pm

    try this:

    INSERT NewDB.center_has_b (center_id, b_id)
     select 'N', oldb_id from OldDB.oldb WHERE centerN = 1
    

    EDIT: This is based on the first comment for this answer

    insert into center_has_b (center_id,b_id)
    select c.enter_id ,old.b_id
    from centers c
    cross join old.b
    where Allcenters = 'Y'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my situation, very much simplified. My classes; public class ClassBase { [Key]
I have two modules like this (very very simplified): main.py: from window import *
I have a MySql db with innoDB tables. Very simplified this is how two
I have this situation (it is very simplified for the sake of this question):
This is a (very) simplified version of my iPhone code : @interface x {
I have this existing schema where a schedule table looks like this (very simplified).
This is a very simplified version of some code I just ran into at
In this very simplified and minimized example click event handler has been defined for
This is a very simplified version of a model I'm working on: class ClothingTop(models.Model):
For example (and this is very simplified), suppose I have a class for every

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.