瀚高数据库group by分组函数如何把字段空串空列归为一类 Published on May 24, 2023 in 随笔 with 0 comment 函数:  ```sql 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函数: 当列是空串,就转换为其他数值 本文由 admin 创作,采用 知识共享署名4.0 国际许可协议进行许可。本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。