[英]When I Try to select rows where the trimmed value of a column is not null, it still returns rows with null values (Snowflake)
SELECT Client_id, first_name, mobile_number
FROM client_table
WHERE trim(mobile_number) IS NOT NULL
Trim does not make the value as NULL but instead an empty string Trim 不会将值设为 NULL 而是一个空字符串
create or replace table table2 (province varchar); insert into table2 (province) values (' '), (' '); select trim(province) from table2 where trim(province,' ') = '';
https://docs.snowflake.com/en/sql-reference/functions/trim.html https://docs.snowflake.com/en/sql-reference/functions/trim.html
If the value of mobile_number can be a null or blanks, I normally do something like this: WHERE COALESCE(trim(mobile_number), '') <> ''如果 mobile_number 的值可以是 null 或空白,我通常会这样做: WHERE COALESCE(trim(mobile_number), '') <> ''
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.