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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:48:09+00:00 2026-06-14T04:48:09+00:00

I am trying to move data from one table into two new tables, but

  • 0

I am trying to move data from one table into two new tables, but I am unsure how I can do this in the best and most foolproof way.

I have about 2000 rows in newsletter_users that looks like this:

userid company email memberofgroup

where

memberofgroup 

is an integer that refers to newsletter_mailgroups. This is not the best way if a user wants to be a member of different groups. Then there will be x rows with the same email. 2000 users x 3 or 4 different groups (what did I think of??) Therefore I have made two new tables

newsletter_members that look like this

userid email company

and another table newsletter_member_of_group that look like this:

field_member_uid field_user_id field_memberofgroup

where

field_user_id

will contain a users id from newsletter_members and

field_memberofgroup 

will contain the emailgroup id. f.x.

field_user_id  field_memberofgroup 
    2                 6
    2                 4
    2                 8
    3                 1
    5                 6

How can I export and then import them in the best way so that emails will not duplicate in newsletter_members? – I might need to do a manual check to see which users a members of more than one mailgroup.

Mailgroups table:

1   Forhandlere 
2   Arkitekter og byggerådgivere   
3   Typehusfabrikanter  
4   Byggeentreprenører 
5   Murermestre 
6   Tømrermestre   
7   Tagdækkere 
8   Boligforeninger/Ejendomsselskaber   
9   Bygge-interesserede 
10  Tyske modtagere 
11  Landskabsarkitekter 
12  Norske arkitekter   
13  Svenske arkitekter  
14  Norske forhandlere  
15  Svenske forhandlere 
16  Brancherelaterede   
17  Svenske ansatte 
18  Norske ansatte  
19  Beijer Sverige  
  • 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-14T04:48:11+00:00Added an answer on June 14, 2026 at 4:48 am

    The solution in few steps:

    • Craete table newsletter_member_of_group.

    Script:

     CREATE TABLE newsletter_member_of_group(
      field_member_uid INT PRIMARY KEY AUTO_INCREMENT,
      field_user_id INT,
      field_memberofgroup INT
    );
    

    Note that field_member_uid is AUTO_INCREMENT, it will help us to insert ID values.

    • Copy data from newsletter_users to newsletter_member_of_group.

    Script:

    INSERT INTO newsletter_member_of_group
      SELECT NULL, userid, memberofgroup FROM newsletter_users;
    
    • Create newsletter_members table. We have two variants: create new table and copy data, or rename newsletter_users to newsletter_members and drop memberofgroup field. I choose second variant.

    Script:

    ALTER TABLE newsletter_users RENAME TO newsletter_members;
    ALTER TABLE newsletter_members DROP COLUMN memberofgroup;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to insert some data from one table into another but I
I'm trying to move the data from one table to another based on names
Im trying to move data from one table to another because the needs of
I am trying to take the data from one table and move it over
I am trying to using a SQL data reader to move records from one
I am trying to move an object from one database into another. The mappings
I'm wondering if it's possible to move all data from one column in table
I'm trying to move some Excel-Data to MySQL, but having troubles with encoding. What
I am trying to move from MySQL to MySQLi but am having some problems.
So I am trying to move selected rows from 1 table to another in

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.