[英]Query to get only numbers from a cell - Snowflake
I have a huge column in Snowflake named "AGE" and 5% of the rows have values like ">80".我在 Snowflake 中有一个名为“AGE”的巨大列,其中 5% 的行具有“>80”之类的值。
I want to filter by people with AGE between [40 55] and I am facing an error "Numeric value '>80' is not recognized".我想按年龄在 [40 55] 之间的人进行过滤,但我遇到了错误“无法识别数值 '>80'”。
I was trying to filter using something like "where ISNUMERIC(PAT_AGE_YR_NBR)=1" but ISNUMERIC is not recognized in Snowflake.我试图使用类似“where ISNUMERIC(PAT_AGE_YR_NBR)=1”的内容进行过滤,但在 Snowflake 中无法识别 ISNUMERIC。 I want to either:
我想要:
Any ideas?有任何想法吗? cheers
干杯
For eg:例如:
select try_to_numeric(col) as a from numtest where a IS NOT NULL and a > 10;
Use a TRY_
function:使用
TRY_
:
WHERE TRY_CAST(PAT_AGE_YR_NBR AS INT) between 40 and 55
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.