I’m not sure you can do this with MySQL alone, since you’d need to save values and reuse them. Here’s a PHP version.
<?php
global $wpdb;
// select all the old postmeta
$oldData = $wpdb->get_results("SELECT * FROM wp_postmeta WHERE meta_key = 'tnid_01old'");
// make sure we have results
if($oldData) {
// loop through each result
foreach($oldData as $meta) {
// save post ID and meta value
$meta_post_id = $meta->post_id;
$metavalue = $meta->meta_value;
// update 'tnid_01' value
$wpdb->update(
// table name
'wp_postmeta',
// value to set
array(
'meta_value' => "$metavalue"
),
// condition to meet: match same post ID but new meta key
array(
'post_id' => $meta_post_id,
'meta_key' => 'tnid_01'
)
)
}
}
?>
If you’re on a low-traffic site, you could temporarily paste this into a theme template file and load whatever page uses that template, then make sure to remove this code so it’s not hitting the database again. Or a more proper way would be to have it run within wp-admin.