Skip to main content
3 of 3
CONCAT Closing ')' was missing otherwise query will through an error
Michael Green
  • 25.1k
  • 13
  • 53
  • 98

Assuming that meta_value is always dd/mm/yyyy and you are looking for yyyymmdd (which isn't clear), try this:

UPDATE wp_postmeta 
SET meta_value = CONCAT(SUBSTRING(meta_value FROM 7), 
     SUBSTRING(meta_value, 4, 2), 
     SUBSTRING(meta_value, 1, 2));

Run that as a SELECT first to verifying the output before update and make sure it's what you're really looking for.

mdoyle
  • 1.6k
  • 13
  • 19