I have 2 tables 'error1" and 'error2' with the very same architecture
error1
| id | IP | numberoftime |
|---|---|---|
| 1 | 127.127 | 56 |
| 2 | 100.100 | 47 |
error2
| id | IP | numberoftime |
|---|---|---|
| 1 | 90.90 | 56 |
| 2 | 100.100 | 32 |
I would like to merge 'error2' table in 'error1' table, but if the IP is the same > change only the column 'numberoftime' by adding the 'numberoftime' from 'error2' to 'error1', for instance if in 'error2', 'numberoftime' is 32 for the same 'IP' "100.100" in 'error1' it add 32 to 47 in error1.
If the IP in 'error1' does not exist, it just add the row in 'error1', WITHOUT the id because 'id' is the primary key, but auto increment (id) at the end of the 'error1' table
so the result should be
error1
| id | IP | numberoftime |
|---|---|---|
| 1 | 127.127 | 56 |
| 2 | 100.100 | 79 |
| 3 | 90.90 | 56 |
Not sure how to do this in a single statement