postgresql 字段连接方式 |
您所在的位置:网站首页 › oracle多个字段拼接后的内容定义不同 › postgresql 字段连接方式 |
postgresql 多种字段拼接方式,以下介绍几种 1.|| 链接符,适用于少量字段连接。 弊端:如果连接字段存在 null 值时,会返回null , 例:select null || '123' 只有字段都为非空时才会返回 非空结过。 2.concat('字段1','拼接符','字段2') 方便直观点,会自动过滤掉字段的null值 例: select concat(name,'-',mobile,null,' ~& ',employee_number) as "pj",name,mobile,employee_number FROM hr.hr_employee_0822 3,concat_ws('连接符','字段1','字段2') 连接符,方便、简便、会过滤null值,连接符统一 以上三种连接方式,可根据自己的业务,选择合适的函数 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |