Unanswered: SH script for copy table from 1 DB to another DB on the same server
Does anyone know of a sh-script (or similar) that can copy a table from 1 database to another database on the same server?
Want to "move" records from table1 in db1 into table2 in db2 (within the same server). Table two has identical table structure, but 1 extra column in which the name of the source site should be put, preferably as a passed-on variable.
Records shall be removed from table1 and put in table2 on a regular basis (cron schedule).
The purpose is both to keep a table from getting too large, and to remove unnecessary content but still have the full history available on a separate database. Will use this script for several sites, moving into table2 on db2, and each record will have the name of the source site in that extra column, so it is possible to filter and query for records per site.
I've done a search for this, but this far I've only been able to find code that copy databases from one server to another.