I would like merge 2 MySQL tables without adding the same lines. I have 2 tables with the sames columns but not the same row, such as.
table_1
+-------+--------+------+
| Name | ResNum | Code |
+-------+--------+------+
| User1 | 25BAM8 | PAR1 |
| User2 | E26J09 | COP3 |
+-------+--------+------+
table_2
+-------+--------+------+
| Name | ResNum | Code |
+-------+--------+------+
| User1 | 25BAM8 | PAR1 |
| User3 | 34VNS2 | PAR1 |
| User4 | EZQVG5 | COP3 |
+-------+--------+------+
我想,在将表2合并到表1时,就这样:
table_1
+-------+--------+------+
| Name | ResNum | Code |
+-------+--------+------+
| User1 | 25BAM8 | PAR1 |
| User2 | E26J09 | COP3 |
| User3 | 34VNS2 | PAR1 |
| User4 | EZQVG5 | COP3 |
+-------+--------+------+
我已经与INSERT IGNORE INTO和REPLACE INTO指挥部一道尝试过,但像以下那样复制了现有各行:
table_1
+-------+--------+------+
| Name | ResNum | Code |
+-------+--------+------+
| User1 | 25BAM8 | PAR1 |
| User1 | 25BAM8 | PAR1 |
| User2 | E26J09 | COP3 |
| User3 | 34VNS2 | PAR1 |
| User4 | EZQVG5 | COP3 |
+-------+--------+------+
希望得到任何帮助。