How do i merge two MySql tables that have a similar structure? The main secrets of these two tables will clash, and so i have take that into consideration.

You may also try:

Place IGNORE

  INTO table_1

Choose *

  FROM table_2

which enables individuals rows in table_1 to supersede individuals in table_2 which have an identical primary key, while still placing rows with new primary secrets.

Alternatively,

REPLACE

   INTO table_1

 Choose *

   FROM table_2

will update individuals rows already in table_1 using the corresponding row from table_2, while placing rows with new primary secrets.

It is dependent around the semantic from the primary key. Whether it's just autoincrement, then use something similar to:

place into table1 (all posts except pk)

choose all_posts_except_pk

from table2

If PK means something, you have to try to pick which record must have priority. You can produce a choose query to locate replicates first (see answer by cpitis). Then get rid of the ones you won't want to keep and employ the above mentioned place to include records that remain.

If you want to get it done by hand, once:

First, merge inside a temporary table, with something similar to:

create table MERGED as (choose * from table 1 UNION choose * from table 2)

Then, identify the main key constraints with something similar to

Choose COUNT(*), PK from MERGED GROUP BY PK Getting COUNT(*) > 1

Where PK may be the primary key area...

Solve the replicates.

Relabel the table.

Place

INTO    first_table f

Choose  *

FROM    second_table s

ON DUPLICATE KEY UPDATE

SET s.column1 = DO_WHAT_EVER_MUST_BE_DONE_ON_KEY_CLASH(f.column1)