瀚高数据库group by分组函数如何把字段空串空列归为一类
warning:
这篇文章距离上次修改已过640天,其中的内容可能已经有所变动。
函数:

select
count (
1
) ,
COALESCE(NULLIF(trim(native_place),''),'其他') AS native_place
from
zhsq_user_info
where
is_delete = '0'
and
to_char (to_Date(create_time,'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd')
between to_char (to_Date(${startTime},'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd') and
to_char (to_Date(${endTime},'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd')
group by
COALESCE(NULLIF(trim(native_place),''),'其他')
COALESCE函数:
当列是空列,就转换为其他数值
NULLIF函数:
当列是空串,就转换为其他数值