select * from D_Info where syl is not null and syl <> '' CAST ( syl AS DECIMAL(18,4)) < 10
字符串类型比较大小最简单的办法就是+0.类似:
select * from table where num+0 < 10
如有帮助,欢迎采纳!
SQL Server使用以下语句:
select * from table where convert(decimal(6, 2), syl)<10
尝试转为float类型,测试可行,但过长的值可能会有精度丢失
select * from tmp.tmp_20220729 where cast(syl as float) < 10;
select * from D_Info where convert(syl, decimal(12,2)) < 10 and syl <> '' and syl is not null;
select cast('123' as signed) from dual; 字符转数字
select * from D_Info where syl is not null and syl < 10
select truncate(cast(abs('414.55555') as decimal(15,3)),3);
字符串转int
来晚了,遇到这类问题可以用cast强转
转成数值类型(float、decimal)再进行比较。