mysql - How can i convert a price field which is currently varchar to a decimal so my prices will order correctly? -


i using mysql.

i have varchar field incorrectly used price. ordering of table not work correctly putting on 1000 bottom of list.

i need convert price field in existing populated database varchar decimal guess?

any appreciated.

simply use alter table statement.

if example table called 'products' , field called 'product_price' use:

alter table products modify column product_price double; 

nb: anything, i'd tempted make backup of data (via mysqldump) prior performing operation - it'll take seconds , it's better safe rather sorry. :-)


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -