I have a table with two columns meta_key
and meta_value
. Both of them are varchar
now for meta_key
_price
the meta_value is a number like 10.0, 20.0 etc. I am trying to update this value to a higher number (percentage increase in price). I am trying to cast meta_value
as integer but it is not working.
Here is what I am trying:
update wp_postmeta set CAST(meta_value AS UNSIGNED)=meta_value+meta_value*(0.60)
where meta_key='_price'
But it gives this error:
error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CAST(meta_value AS UNSIGNED)=CAST'
What I am doing wrong?