1 year ago

#376601

test-img

Lehren

Mysql truncated incorrect double value when CREATE TABLE AS

I have a simple table called feed

id price
1 20,00
2 30,00
3 40,00
4 abcdef
5

Where price is a VARCHAR column. This is important. Now I can do a simple query such as

select * from feed where price > 20 and it works, because of implicit type casting by mysql.

But if I do this query create table results as select id, price from feed where price > 20 It fails with truncated incorrect DOUBLE value: 20,00

Even if I put cast(price as decimal) in the query in both the SELECT and WHERE, it still fails.

How can I suppress this error or fix it?

mysql

casting

double

truncate

0 Answers

Your Answer

Accepted video resources