mysqldump - Merging tables in MySQL - sum up columns -


I have an interesting problem, I'm sure it's a simple answer, but I do not think docs do.

I have different database tables on different servers that have the same table schema with the same primary key.

I want to merge tables together on one server. However, if the line on Server1.Table1 is present in Server2.Table2, then I sum the total amount in the specified column.

Table1 {column_pk, counter}; "Test 1", 3 "Test 2", 4

Table 2 {column_pk, counter}; "Test1", 5 "test2", 6

So after my merger I want to:

"test1", 8 "test2", 10

Actually I

What are my options?

appreciate someone I input, thank you

  Tebl_inu ( Column_pk, counter) VALUES ('test', 4) Duplicate key update c = C + 4;  

Where 4 and test are replaced with your actual data.

How do you get the export file containing those questions, I suggest you use regular expressions to modify a standard export. Or both of them in the same table and they are suggested as suggested by


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -