I found some options to run a mysql query to migrate/split one table into 2 new tables, but one of the fields I would like to create on the new table has to be the same as in the other new table:
So from the “From_payments” table, I would like to create 2 new tables called: “To_paymenttransaction” and “To_paymentinfo”. A lof of the field are predefined and some are from the old table. The only problem is that the predefined field “paymentinfoid” has to be the same is both new tables.
**To_paymenttransaction** --- < --- **From_payments**
paymenttransactionid ------- < --- (Generate next available number in this column)
paymentinfoid -------------- < --- (Generate next available number in this column)
transactionid --------------- < --- txn_id
state ---------------------- < --- (Set all to "1")
amount -------------------- < --- mc_gross
currency ------------------- < --- mc_currency
dateline -------------------- < --- payment_date
paymentapiid --------------- < --- (Set all to "1")
request -------------------- < --- (Set all to "NULL")
reversed ------------------- < --- (Set all to "0")
**To_paymentinfo** -----------<
paymentinfoid -------------- < --- (Same generated number that goes to the paymentinfoif field in To_paymenttransaction table )
hash ----------------------- < --- (Set all to "Imported")
subscriptionid --------------- < --- (Set all to "1")
subscriptionsubid ------------ < --- ("2" IF above field mc_gross is 4, "1" IF above field mc_gross is 6, "0" IF above field mc_gross is 10)
userid ---------------------- < --- userid
completed ------------------ < --- (Set all to "0")
Any ideas?
All help is greatly appreciated.
Maybe generate the paymentinfoid on the original table before you split it. Then you can copy that single entry into each of the new tables.