user1040364
user1040364

Reputation: 103

mysql copy column and convert string

what wrong with this code i want to copy Hno to Hno2 but change from / to . such as 12/3 to 12.3 i use mysql

update set hno2 =   SELECT REPLACE(hno, '/', '.') FROM member;

Hno varchar(255) DEFAULT NULL,
Hno2 decimal(8,4) NOT NULL,

Upvotes: 0

Views: 123

Answers (1)

ravnur
ravnur

Reputation: 2852

update member
set hhno2 = replace(CAST(hno AS char), '/', '.');

Upvotes: 2

Related Questions