For all the “price” custom fields of a site, the dollar sign was entered with the value. I need to remove the dollar sign and leave the just the values.

I know very little about SQL queries. The values are all different, so I was hoping I could use UPDATE and the wildcard to effectively delete the dollar sign, but alas, I can’t make it happen.

This is what I’m trying to achieve

UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘$%’, ‘%’) WHERE meta_key LIKE ‘price’.

1 Answer
1

Why doesn’t this work?

UPDATE wp_postmeta 
SET meta_value = REPLACE( meta_value, '$', '' ) 
WHERE meta_key LIKE 'price';

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *