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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:10:39+00:00 2026-05-23T23:10:39+00:00

tableone a |b| c ——– a1 | |c1 a2 | |c2 a3 | |c3

  • 0

tableone

a  |b| c
--------
a1 | |c1
a2 | |c2
a3 | |c3

tabletwo

a | b
-----
a1|b1
a2|b2
a3|b3
a4|b4
a5|b5

merged

a | b | c
a1| b1|c1
a2| b2|c2
a3| b3|c3
a4| b4|
a5| b5|

So I have the two table and I want to merge them. I tried in phpmyadmin these two options:

INSERT IGNORE INTO tableone SELECT * FROM tabletwo;
REPLACE INTO tableone SELECT * FROM tabletwo;

But both do the same (put one table on another), but I want to merge them. So what query must I use? I hope you understand the the question…

  • 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-23T23:10:40+00:00Added an answer on May 23, 2026 at 11:10 pm

    Try these queries back-to-back:

    INSERT IGNORE INTO tableone (a) SELECT a FROM tabletwo;
    
    UPDATE tableone, tabletwo
    SET tableone.b = tabletwo.b
    WHERE tableone.a = tabletwo.a;
    

    To answer pst, something like this, assuming that tableone does not have a b column:

    INSERT INTO tablethree (a, b, c)
    
    SELECT * FROM ((
        SELECT
            tableone.a AS a,
            tabletwo.b AS b,
            tableone.c AS c
    
        FROM tableone
    
        LEFT OUTER JOIN tabletwo
        ON tableone.a = tabletwo.a
    ) UNION (
        SELECT
            tabletwo.a AS a,
            tabletwo.b AS b,
            tableone.c AS c
    
        FROM tableone
    
        RIGHT OUTER JOIN tabletwo
        ON tableone.a = tabletwo.a
    )) AS x
    

    This is untested, but should work. (“Should”…) The UNION is a workaround for MySQL’s lack of FULL OUTER JOIN.

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

Sidebar

Related Questions

I have two tables, that relate via a one-to-many relationship i.e tableOne (1)----------(*) tableTwo
I have table one which looks like this. And I want to get data
I have two tables with this structure: Table one: ID Description Table two: ID
I want to select everything from table one, which contains a column JID. These
So I have two tables, Table1 and Table2. Table one has an integer that
I have the following two tables: TableOne ======== Id1|ColA1|ColB1|ColC1|ColD1|ColE1 -------------------------------- 1| AFoo|BFoo |CFoo |
Table one: products Which have fields like products_id products_price master_categories_id Table two: specials .
I have a table which contains a two column( start_time and end_time ).I am
I have two tables: CREATE TABLE `category` ( `category_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
Many applications have grids that display data from a database table one page at

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.