Skip to main content
CONCAT Closing ')' was missing otherwise query will through an error
Source Link
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 outoutput before update and make sure it's what you're really looking for.

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 out before update and make sure it's what you're really looking for.

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.

CONCAT Closing ')' was missing otherwise query will through an error
Source Link

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 out before update and make sure it's what you're really looking for.

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 make sure it's what you're really looking for.

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 out before update and make sure it's what you're really looking for.

Source Link
mdoyle
  • 1.6k
  • 13
  • 19

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 make sure it's what you're really looking for.