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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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