• 首页
  • 邻居
  • 关于
  • 归档
  • 搜索
  • 夜间模式
    ©2020-2026  我的学习笔记 Theme by OneBlog

    我的学习笔记博客

    搜索
    标签
    # 随笔 # Java # 教程 # openwrt # Mysql # SQL # 爬虫 # post # Js调优 # MAVEN
  • 首页>
  • 随笔>
  • 正文
  • 瀚高数据库group by分组函数如何把字段空串空列归为一类

    2023年05月24日 1.5 k 阅读 0 评论 667 字

    函数:

    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 ] 享有,未经作者书面授权,禁止转载,封面图片来源于 [ 互联网 ] ,本文仅供个人学习、研究和欣赏使用。如有异议,请联系博主及时处理。
    取消回复

    发表留言
    回复

    首页邻居关于归档
    Copyright©2020-2026  All Rights Reserved.  Load:0.020 s
    京ICP备18019712号
    Theme by OneBlog V3.6.5
    夜间模式

    开源不易,请尊重作者版权,保留基本的版权信息。