Skip to content

Instantly share code, notes, and snippets.

@landbryo
Created June 4, 2018 20:48
Show Gist options
  • Save landbryo/cd89b8bfe8d915664f008d46f2e33af3 to your computer and use it in GitHub Desktop.
Save landbryo/cd89b8bfe8d915664f008d46f2e33af3 to your computer and use it in GitHub Desktop.
Useful MySQL select and update
/* find all matches for strings starting with 2070 in the fire_date column of the termmeta table */
SELECT * FROM `as9g6f0_termmeta` WHERE `meta_key` LIKE 'fire_date' AND `meta_value` LIKE '2070%';
/* find all matches for strings starting with 2070 in the fire_date column of the termmeta table and replace them with 1970 */
UPDATE as9g6f0_termmeta
SET meta_value = REPLACE(meta_value,'2070','1970')
WHERE `meta_key` LIKE 'fire_date' AND `meta_value` LIKE '2070%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment