MYSQL how to convert varchar to bigint

时间:2017-10-12 10:13:50

标签: mysql

Mysql How to convert a column of the type varchar 2017-10-10 23:59:21.087 to bigint?

I want to convert the type '2017-10-10 23:59:21.087' to 20171010235921087

1 个答案:

答案 0 :(得分:0)

你走了:

select REPLACE(REPLACE(REPLACE('2017-10-10 23:59:21.087', '-', ''), ':', ''), ' ', '')

如果它是表格中的字段,请执行以下操作:

SELECT REPLACE(REPLACE(REPLACE(forex_lastupdate, '-', ''), ':', ''), ' ', '')
FROM noksek_tickdata_copy;