P粉8262835292023-08-03 11:24:36
document_id
, meta_key
, and meta_value
. You want to update the meta_value of the row whose meta_key is bankaccount to the row whose meta_key is iban. The corresponding meta_value.
The following is a SQL query to achieve this goal:
UPDATE example_table AS p1 INNER JOIN ( SELECT document_id, meta_value AS iban FROM example_table WHERE meta_key = 'iban' ) AS p2 ON p1.document_id = p2.document_id SET p1.meta_value = p2.iban WHERE p1.meta_key = 'bankaccount';
Before running any update queries, remember to back up your database and test it in a secure environment!