I am having trouble writing a SQL Statement that would update and replace all the values in my WordPress Database. I am a really just trying to replace all value of wp_capabilities
with wp_130638636_capabilities
in my meta_key
column inside my wp_130638636_usermeta
table.
See my screenshot below:
For example the line below will change one row:
UPDATE wp_130638636_usermeta
SET meta_key
= ‘wp_130638636_capabilities’ WHERE wp_130638636_usermeta
.umeta_id
= 6175;
But instead I only want to change the values of the meta_key
that are wp_capabilities
to wp_130638636_capabilities
. If that value in meta_key
doesn’t have wp_capabilities
, then the value shouldnt change.
Is this correct:
UPDATE wp_130638636_usermeta
SET meta_key
= ‘wp_130638636_capabilities’ WHERE meta_key
= wp_130638636
;
2
Answers
I believe that this is the correct statement. Update the column meta_key where meta_key is equal to ‘wp_capabilities’ to the new value ‘wp_130638636_capabilities’ This will not update any null values.
Try this, I have just tried and it worked like a charm.