minus varchar mysql

field b is varchar but all of them is number   4.1  4 12.5  41 20 3.2   how can  minus  1 for all member
teeraAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
why is the field varchar, if it contains all numbers?

anyhow, for the math/update, you do a cast:
http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html
update yourtable set yourfield = cast(yourfield as DECIMAL) -1

Open in new window


hope this helps
0
 
awking00Commented:
select convert(b,decimal) - 1
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.