Link to home
Start Free TrialLog in
Avatar of Nicolas Lagios
Nicolas Lagios

asked on

Help, need phpmyadmin sql query for search & edit/delete

I need an sql query to search "wp_postmeta" table for rows with meta_key "price" and meta_value more than 1 thousand (eg 1.084.51) and delete the first dot of the meta_value.
before: 1.084.51 -> after: 1084.51
I dont know if it is possible to do this with an sql query, anyway I hope it is possible.

Here is a picture:
User generated image

Thanks in advance, Nicolas...
ASKER CERTIFIED SOLUTION
Avatar of Walter Ritzel
Walter Ritzel
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nicolas Lagios
Nicolas Lagios

ASKER

Actually accidentally in the first line between wp & postmeta you have add a dash instead of put an underscore.

The code is working 100%, thank you very much Walter Ritzel, appreciate for your time.

This is the code:

update wp_postmeta
set meta_value = SUBSTR(CONVERT(CONVERT(REPLACE(META_VALUE,'.',''),DECIMAL(16))/100.00,CHAR),1,LENGTH(CONVERT(CONVERT(REPLACE(META_VALUE,'.',''),DECIMAL(16))/100.00,CHAR))-2)
where meta_key = 'price';

Open in new window